diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0dc4b51ac..ca08c07591a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,13 @@ - Added `EuiColorPicker`. ((328)[https://github.com/elastic/eui/pull/328]) - `EuiCodeBlock` now only shows fullscreen icons if `overflowHeight` prop is set. Also forces large fonts and padding while expanded. [(#325)](https://github.com/elastic/eui/pull/325) - Exported `VISUALIZATION_COLORS` from services ((#329)[https://github.com/elastic/eui/pull/329]) +- Add typescript definitions for ``, ``, ``, ``, `` and ``. [(#326)](https://github.com/elastic/eui/pull/326) **Breaking changes** - `EuiCodeBlock` now only shows fullscreen icons if `overflowHeight` prop is set. Also forces large fonts and padding while expanded. [(#325)](https://github.com/elastic/eui/pull/325) - React ^16.2 is now a peer dependency ([#264](https://github.com/elastic/eui/pull/264)) +- `` no longer accepts the `indeterminate` property, which never had any effect. [(#326)](https://github.com/elastic/eui/pull/326) **Bug fixes** diff --git a/src/components/form/form_row/index.d.ts b/src/components/form/form_row/index.d.ts new file mode 100644 index 00000000000..b2eb7becdf3 --- /dev/null +++ b/src/components/form/form_row/index.d.ts @@ -0,0 +1,21 @@ +/// + +import { SFC, ReactNode, HTMLAttributes } from 'react'; + +declare module '@elastic/eui' { + /** + * @see './form_row.js' + */ + + export type EuiFormRowProps = CommonProps & + HTMLAttributes & { + error?: string | string[]; + fullWidth?: boolean; + hasEmptyLabelSpace?: boolean; + helpText?: ReactNode; + isInvalid?: boolean; + label?: ReactNode; + }; + + export const EuiFormRow: SFC; +} diff --git a/src/components/form/index.d.ts b/src/components/form/index.d.ts index 9f634983baa..1c2d5c4b02e 100644 --- a/src/components/form/index.d.ts +++ b/src/components/form/index.d.ts @@ -1,2 +1,5 @@ /// /// +/// +/// +/// diff --git a/src/components/form/radio/index.d.ts b/src/components/form/radio/index.d.ts new file mode 100644 index 00000000000..78c8c2cdb1c --- /dev/null +++ b/src/components/form/radio/index.d.ts @@ -0,0 +1,26 @@ +/// + +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, 'onChange'> & { + options?: EuiRadioGroupOption[]; + idSelected?: string; + onChange: EuiRadioGroupChangeCallback; + }; + + export type x = EuiRadioGroupProps['onChange']; + + export const EuiRadioGroup: SFC; +} diff --git a/src/components/form/switch/index.d.ts b/src/components/form/switch/index.d.ts new file mode 100644 index 00000000000..2e6aac98184 --- /dev/null +++ b/src/components/form/switch/index.d.ts @@ -0,0 +1,18 @@ +/// + +import { SFC, InputHTMLAttributes, ReactNode } from 'react'; + +declare module '@elastic/eui' { + /** + * @see './switch.js' + */ + export type EuiSwitchChangeCallback = (state: boolean) => void; + + export type EuiSwitchProps = CommonProps & + Omit, 'onChange'> & { + label?: ReactNode; + onChange?: EuiSwitchChangeCallback; + }; + + export const EuiSwitch: SFC; +} diff --git a/src/components/index.d.ts b/src/components/index.d.ts index 6a028a07499..709b3b456cf 100644 --- a/src/components/index.d.ts +++ b/src/components/index.d.ts @@ -10,3 +10,5 @@ /// /// /// +/// +/// diff --git a/src/components/loading/index.d.ts b/src/components/loading/index.d.ts new file mode 100644 index 00000000000..5ae707dfee0 --- /dev/null +++ b/src/components/loading/index.d.ts @@ -0,0 +1,30 @@ +/// + +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 & { + size?: EuiLoadingSpinnerSize; + }; + + export const EuiLoadingSpinner: SFC; + + /** + * @see './loading_chart.js' + */ + export type EuiLoadingChartSize = 'm' | 'l' | 'xl'; + + export type EuiLoadingChartProps = CommonProps & + HTMLAttributes & { + mono?: boolean; + size?: EuiLoadingChartSize; + }; + + export const EuiLoadingChart: SFC; +} diff --git a/src/components/loading/loading_chart.js b/src/components/loading/loading_chart.js index ee7cc5c5183..6b5af4bcab4 100644 --- a/src/components/loading/loading_chart.js +++ b/src/components/loading/loading_chart.js @@ -32,6 +32,10 @@ export const EuiLoadingChart = ({ size, mono, className, ...rest }) => { }; EuiLoadingChart.propTypes = { - size: PropTypes.oneOf(SIZES), + mono: PropTypes.bool, + size: PropTypes.oneOf(SIZES) }; +EuiLoadingChart.defaultProps = { + mono: false +}; diff --git a/src/components/progress/index.d.ts b/src/components/progress/index.d.ts new file mode 100644 index 00000000000..a80244de69c --- /dev/null +++ b/src/components/progress/index.d.ts @@ -0,0 +1,29 @@ +/// + +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 & { + size?: EuiProgressSize; + color?: EuiProgressColor; + position?: EuiProgressPosition; + max?: number; + }; + + export const EuiProgress: SFC; +} diff --git a/src/components/progress/progress.js b/src/components/progress/progress.js index 840d1cce4d4..da323279b51 100644 --- a/src/components/progress/progress.js +++ b/src/components/progress/progress.js @@ -74,7 +74,6 @@ EuiProgress.propTypes = { color: PropTypes.oneOf(COLORS), position: PropTypes.oneOf(POSITIONS), max: PropTypes.number, - indeterminate: PropTypes.bool, }; EuiProgress.defaultProps = {