From 98d97c7a5387471ed8f5d618458da2d13bdd16ab Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Mon, 18 Mar 2019 11:34:42 +0100 Subject: [PATCH] add EuiListGroup and EuiListGroupItem type definitions. --- src/components/list_group/index.d.ts | 35 +++++++++++++++++++++++-- src/components/list_group/list_group.js | 10 +------ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/components/list_group/index.d.ts b/src/components/list_group/index.d.ts index 0b652b732c71..f219655a8bf1 100644 --- a/src/components/list_group/index.d.ts +++ b/src/components/list_group/index.d.ts @@ -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' { /** @@ -9,8 +10,38 @@ declare module '@elastic/eui' { */ type EuiListGroupProps = CommonProps & { - + bordered?: boolean; + flush?: boolean; + listItems?: FunctionComponent[]; + maxWidth?: boolean | number | string; + showToolTips?: boolean; + wrapText?: boolean; }; export const EuiListGroup: FunctionComponent; + + /** + * 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; } diff --git a/src/components/list_group/list_group.js b/src/components/list_group/list_group.js index 5dd888221789..bdbcb171253c 100644 --- a/src/components/list_group/list_group.js +++ b/src/components/list_group/list_group.js @@ -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,