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

Add missing TS defs and fixing existing def #1240

Merged
merged 5 commits into from
Oct 15, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Add TypeScript definitions for `EuiFieldNumber, `EuiFormLabel` and `EuiSelect`, and fix the `EuiTextColor` definition. ([#1240](https://github.com/elastic/eui/pull/1240))
- Added support for nodes as column headers in `EuiBasicTable` for supporting things like tooltips and localized text. ([#1234](https://github.com/elastic/eui/pull/1234))

## [`4.4.1`](https://github.com/elastic/eui/tree/v4.4.1)
Expand Down
26 changes: 26 additions & 0 deletions src/components/form/field_number/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference path="../../common.d.ts" />
/// <reference path="../../icon/index.d.ts" />

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

declare module '@elastic/eui' {

/**
* text field type defs
*
* @see './field_number.js'
*/
export interface EuiFieldNumberProps {
icon?: IconType;
isInvalid?: boolean;
fullWidth?: boolean;
isLoading?: boolean;
compressed?: boolean;
prepend?: ReactNode | ReactNode[];
append?: ReactNode | ReactNode[];
}

export const EuiFieldNumber: SFC<
CommonProps & InputHTMLAttributes<HTMLInputElement> & EuiFieldNumberProps
>;
}
17 changes: 17 additions & 0 deletions src/components/form/form_label/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference path="../../common.d.ts" />

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

declare module '@elastic/eui' {
/**
* @see './form_label.js'
*/

export type EuiFormLabelProps = CommonProps &
LabelHTMLAttributes<HTMLLabelElement> & {
isFocused?: boolean;
isInvalid?: boolean;
};

export const EuiFormLabel: SFC<EuiFormLabelProps>;
}
5 changes: 4 additions & 1 deletion src/components/form/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/// <reference path="./checkbox/index.d.ts" />
/// <reference path="./field_text/index.d.ts" />
/// <reference path="./field_number/index.d.ts" />
/// <reference path="./field_search/index.d.ts" />
/// <reference path="./field_text/index.d.ts" />
/// <reference path="./form_label/index.d.ts" />
/// <reference path="./form_row/index.d.ts" />
/// <reference path="./radio/index.d.ts" />
/// <reference path="./select/index.d.ts" />
/// <reference path="./switch/index.d.ts" />
/// <reference path="./text_area/index.d.ts" />
26 changes: 26 additions & 0 deletions src/components/form/select/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference path="../../common.d.ts" />

import {SFC, ReactNode, Ref, OptionHTMLAttributes, SelectHTMLAttributes} from 'react';

declare module '@elastic/eui' {
/**
* @see './select.js'
*/

export type EuiSelectProps = CommonProps &
SelectHTMLAttributes<HTMLSelectElement> & {
name?: string;
id?: string;
options: Array<{ text: ReactNode } & OptionHTMLAttributes<HTMLOptionElement>>;
isInvalid?: boolean;
fullWidth?: boolean;
isLoading?: boolean;
hasNoInitialSelection?: boolean;
inputRef?: Ref<HTMLSelectElement>;
compressed?: boolean;
prepend?: ReactNode | ReactNode[];
append?: ReactNode | ReactNode[];
};

export const EuiSelect: SFC<EuiSelectProps>;
}
15 changes: 11 additions & 4 deletions src/components/text/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ declare module '@elastic/eui' {
* @see './text.js'
* @see './text_color.js'
*/
type EuiTextSize = 's' | 'xs';
type SIZES = 's' | 'xs';

type EuiTextColor =
type COLORS =
| 'default'
| 'subdued'
| 'secondary'
Expand All @@ -22,9 +22,16 @@ declare module '@elastic/eui' {

type EuiTextProps = CommonProps &
HTMLAttributes<HTMLDivElement> & {
size?: EuiTextSize;
color?: EuiTextColor;
size?: SIZES;
color?: COLORS;
};

type EuiTextColorProps = CommonProps &
HTMLAttributes<HTMLDivElement> &
HTMLAttributes<HTMLSpanElement> & {
color?: COLORS;
};

export const EuiText: SFC<EuiTextProps>;
export const EuiTextColor: SFC<EuiTextColorProps>;
}