-
Notifications
You must be signed in to change notification settings - Fork 843
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
Add typescript definitions for more components #326
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,21 @@ | ||
/// <reference path="../../common.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './form_row.js' | ||
*/ | ||
|
||
export type EuiFormRowProps = CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
error?: string | string[]; | ||
fullWidth?: boolean; | ||
hasEmptyLabelSpace?: boolean; | ||
helpText?: ReactNode; | ||
isInvalid?: boolean; | ||
label?: ReactNode; | ||
}; | ||
|
||
export const EuiFormRow: SFC<EuiFormRowProps>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/// <reference path="./checkbox/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" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="../../common.d.ts" /> | ||
|
||
import { SFC, HTMLAttributes, ReactNode } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './radio_group.js' | ||
*/ | ||
export interface EuiRadioGroupOption { | ||
id: string; | ||
label?: ReactNode; | ||
} | ||
|
||
export type EuiRadioGroupChangeCallback = (id: string) => void; | ||
|
||
export type EuiRadioGroupProps = CommonProps & | ||
Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> & { | ||
options?: EuiRadioGroupOption[]; | ||
idSelected?: string; | ||
onChange: EuiRadioGroupChangeCallback; | ||
}; | ||
|
||
export type x = EuiRadioGroupProps['onChange']; | ||
|
||
export const EuiRadioGroup: SFC<EuiRadioGroupProps>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../../common.d.ts" /> | ||
|
||
import { SFC, InputHTMLAttributes, ReactNode } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './switch.js' | ||
*/ | ||
export type EuiSwitchChangeCallback = (state: boolean) => void; | ||
|
||
export type EuiSwitchProps = CommonProps & | ||
Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> & { | ||
label?: ReactNode; | ||
onChange?: EuiSwitchChangeCallback; | ||
}; | ||
|
||
export const EuiSwitch: SFC<EuiSwitchProps>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './loading_spinner.js' | ||
*/ | ||
export type EuiLoadingSpinnerSize = 's' | 'm' | 'l' | 'xl'; | ||
|
||
export type EuiLoadingSpinnerProps = CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
size?: EuiLoadingSpinnerSize; | ||
}; | ||
|
||
export const EuiLoadingSpinner: SFC<EuiLoadingSpinnerProps>; | ||
|
||
/** | ||
* @see './loading_chart.js' | ||
*/ | ||
export type EuiLoadingChartSize = 'm' | 'l' | 'xl'; | ||
|
||
export type EuiLoadingChartProps = CommonProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
mono?: boolean; | ||
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 we take this opportunity to also add |
||
size?: EuiLoadingChartSize; | ||
}; | ||
|
||
export const EuiLoadingChart: SFC<EuiLoadingChartProps>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* @see './progress.js' | ||
*/ | ||
export type EuiProgressColor = | ||
| 'accent' | ||
| 'danger' | ||
| 'primary' | ||
| 'secondary' | ||
| 'subdued'; | ||
|
||
export type EuiProgressSize = 'xs' | 's' | 'm' | 'l'; | ||
|
||
export type EuiProgressPosition = 'fixed' | 'absolute' | 'static'; | ||
|
||
export type EuiProgressProps = CommonProps & | ||
HTMLAttributes<HTMLProgressElement> & { | ||
size?: EuiProgressSize; | ||
color?: EuiProgressColor; | ||
position?: EuiProgressPosition; | ||
max?: number; | ||
}; | ||
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 we use this opportunity to remove unused 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. Looks like that should be a safe change. The tests did not cover it anyway. @snide, any objections? 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. Indeterminate progress bars were still being used last time I checked. Why do you want to remove it? 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 property does not seem to be used anywhere in the component itself. It is passed on to the |
||
|
||
export const EuiProgress: SFC<EuiProgressProps>; | ||
} |
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.
should be required
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.
It is listed in
defaultProps
though, which suggests the intention is for it to be optional.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.
good point, I didn't see the default props... it's still marked as a required propType (not sure how that behaves along with the default prop... would it still shout if one is not supplied?). In any case, we need to have a decision - it's either required or optional with a default... it make little sense to be both :)
/cc @snide ^
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
defaultProps
lead toisRequired
not shouting.