Skip to content

Commit

Permalink
add EuiListGroup and EuiListGroupItem type definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Mar 18, 2019
1 parent 76e8fb5 commit 98d97c7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
35 changes: 33 additions & 2 deletions src/components/list_group/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IconType } from '../icon'
import { CommonProps } from '../common';
import { FunctionComponent } from 'react';
import { FunctionComponent, ReactNode, ReactPropTypes } from 'react';

declare module '@elastic/eui' {
/**
Expand All @@ -9,8 +10,38 @@ declare module '@elastic/eui' {
*/

type EuiListGroupProps = CommonProps & {

bordered?: boolean;
flush?: boolean;
listItems?: FunctionComponent<EuiListGroupItemProps>[];
maxWidth?: boolean | number | string;
showToolTips?: boolean;
wrapText?: boolean;
};

export const EuiListGroup: FunctionComponent<EuiListGroupProps>;

/**
* list group item type defs
*
* @see './list_group_item.js'
*/

type EuiListGroupItemProps = CommonProps & {
size?: 'xs' | 's' | 'm' | 'l';
label: ReactNode;
isActive?: boolean;
isDisabled?: boolean;
href?: string;
iconType?: IconType;
icon?: ReactPropTypes['element'];
showToolTip?: boolean;
extraAction?: {
iconType: IconType;
alwaysShow?: boolean;
};
onClick?(): void;
wrapText?: boolean;
};

export const EuiListGroupItem: FunctionComponent<EuiListGroupItemProps>;
}
10 changes: 1 addition & 9 deletions src/components/list_group/list_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,7 @@ export const EuiListGroup = ({
};

EuiListGroup.propTypes = {
listItems: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.node,
href: PropTypes.string,
extraAction: PropTypes.object,
iconType: PropTypes.string,
isActive: PropTypes.boolean,
isDisabled: PropTypes.boolean,
showToolTip: PropTypes.boolean,
})),
listItems: PropTypes.arrayOf(EuiListGroupItem.propTypes),
children: PropTypes.node,
className: PropTypes.string,

Expand Down

0 comments on commit 98d97c7

Please sign in to comment.