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 definition changes #1247

Merged
merged 2 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `4.5.1`.
**Bug fixes**

* TypeScript definition changes for `EuiAccordion`, `EuiDescriptionList`, `EuiForm`, `EuiFormHelpText` and the accessibility services, plus a number of other TS fixes ([#1247](https://github.com/elastic/eui/pull/1247))

## [`4.5.1`](https://github.com/elastic/eui/tree/v4.5.1)

Expand Down
18 changes: 18 additions & 0 deletions src/components/accordion/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { HTMLAttributes, Component, ReactNode } from 'react';

declare module '@elastic/eui' {
export type EuiAccordionSize = 'none' | 'xs' | 's' | 'm' | 'l' | 'xl';

export interface EuiAccordionProps {
id: string;
buttonContentClassName?: string;
buttonContent?: ReactNode;
extraAction?: ReactNode;
initialIsOpen?: boolean;
paddingSize?: EuiAccordionSize;
}

export class EuiAccordion extends Component<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiAccordionProps
> {}
}
1 change: 1 addition & 0 deletions src/components/button/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ declare module '@elastic/eui' {
'aria-label'?: string;
'aria-labelledby'?: string;
isDisabled?: boolean;
size?: ButtonSize;
}
export const EuiButtonIcon: SFC<
EuiButtonPropsForButtonOrLink<CommonProps & EuiButtonIconProps>
Expand Down
2 changes: 1 addition & 1 deletion src/components/combo_box/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
declare module '@elastic/eui' {
export type EuiComboBoxOptionProps = ButtonHTMLAttributes<HTMLButtonElement> & {
label: string,
isGroupLabelOption: boolean,
isGroupLabelOption?: boolean,
}

export type EuiComboBoxOptionsListPosition = 'top' | 'bottom'
Expand Down
31 changes: 31 additions & 0 deletions src/components/description_list/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { HTMLAttributes, Component, ReactNode } from 'react';

declare module '@elastic/eui' {
export type EuiDescriptionListType = 'row' | 'column' | 'inline';
export type EuiDescriptionListAlignment = 'center' | 'left';
export type EuiDescriptionListTextStyle = 'normal' | 'reverse';

export interface EuiDescriptionListProps {
listItems?: Array<{ title: ReactNode, description: ReactNode }>;
align?: EuiDescriptionListAlignment;
compressed?: boolean;
textStyle?: EuiDescriptionListTextStyle;
type?: EuiDescriptionListType;
}

export class EuiDescriptionList extends Component<
CommonProps & HTMLAttributes<HTMLDListElement> & EuiDescriptionListProps
> {}

export interface EuiDescriptionListTitleProps {}

export class EuiDescriptionListTitle extends Component<
CommonProps & HTMLAttributes<HTMLElement> & EuiDescriptionListTitleProps
> {}

export interface EuiDescriptionListDescriptionProps {}

export class EuiDescriptionListDescription extends Component<
CommonProps & HTMLAttributes<HTMLElement> & EuiDescriptionListDescriptionProps
> {}
}
4 changes: 2 additions & 2 deletions src/components/form/checkbox/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, ChangeEventHandler } from 'react';
import { SFC, ReactNode, HTMLAttributes, ChangeEventHandler, InputHTMLAttributes } from 'react';

declare module '@elastic/eui' {
/**
Expand All @@ -22,7 +22,7 @@ declare module '@elastic/eui' {
}

export const EuiCheckbox: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiCheckboxProps
CommonProps & InputHTMLAttributes<HTMLDivElement> & EuiCheckboxProps
pugnascotia marked this conversation as resolved.
Show resolved Hide resolved
>;

/**
Expand Down
17 changes: 17 additions & 0 deletions src/components/form/form_help_text/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// <reference path="../../common.d.ts" />
/// <reference path="../../icon/index.d.ts" />

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

declare module '@elastic/eui' {

/**
* @see './field_help_text.js'
*/
export interface EuiFormHelpTextProps {
}

export const EuiFormHelpText: SFC<
CommonProps & HTMLAttributes<HTMLDivElement> & EuiFormHelpTextProps
>;
}
2 changes: 1 addition & 1 deletion src/components/form/form_row/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ declare module '@elastic/eui' {

export type EuiFormRowProps = CommonProps &
HTMLAttributes<HTMLDivElement> & {
error?: string | string[];
error?: ReactNode | ReactNode[];
fullWidth?: boolean;
hasEmptyLabelSpace?: boolean;
helpText?: ReactNode;
Expand Down
17 changes: 17 additions & 0 deletions src/components/form/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
/// <reference path="../common.d.ts" />
/// <reference path="./checkbox/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_help_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" />

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

declare module '@elastic/eui' {
/**
* @see './form.js'
*/
export type EuiFormProps = CommonProps &
FormHTMLAttributes<HTMLFormElement> & {
isInvalid?: boolean;
error?: ReactNode | ReactNode[];
};

export const EuiForm: SFC<EuiFormProps>;
}
2 changes: 2 additions & 0 deletions src/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/// <reference path="./common.d.ts" />
/// <reference path="./accordion/index.d.ts" />
/// <reference path="./avatar/index.d.ts" />
/// <reference path="./button/index.d.ts" />
/// <reference path="./combo_box/index.d.ts" />
/// <reference path="./context_menu/index.d.ts" />
/// <reference path="./description_list/index.d.ts" />
/// <reference path="./flex/index.d.ts" />
/// <reference path="./health/index.d.ts" />
/// <reference path="./icon/index.d.ts" />
Expand Down
1 change: 1 addition & 0 deletions src/components/text/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ declare module '@elastic/eui' {
HTMLAttributes<HTMLDivElement> & {
size?: SIZES;
color?: COLORS;
grow?: boolean;
};

type EuiTextColorProps = CommonProps &
Expand Down
3 changes: 2 additions & 1 deletion src/components/tool_tip/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactElement, ReactNode, SFC } from 'react';

declare module '@elastic/eui' {
export type ToolTipPositions =
export type ToolTipPositions =
| 'top'
| 'right'
| 'bottom'
Expand All @@ -22,6 +22,7 @@ declare module '@elastic/eui' {
type?: string;
size?: string;
'aria-label'?: string;
content: ReactNode;
}
export const EuiIconTip: SFC<EuiIconTipProps>;
}
6 changes: 6 additions & 0 deletions src/services/accessibility/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '@elastic/eui' {
export const accessibleClickKeys: { [keyCode: number]: string };
export const cascadingMenuKeyCodes: { [keyCodeName: string]: keyCodes };
export const comboBoxKeyCodes: { [keyCodeName: string]: keyCodes };
export const htmlIdGenerator: (prefix?: string) => (suffix?: string) => string;
}
1 change: 1 addition & 0 deletions src/services/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference path="./accessibility/index.d.ts" />
/// <reference path="./alignment.d.ts" />
/// <reference path="./key_codes.d.ts" />
/// <reference path="./color/index.d.ts" />
Expand Down