Skip to content

Commit

Permalink
Review feedback: Create union types to support full component options.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Mar 19, 2019
1 parent af90e00 commit 64f9e6f
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions src/components/list_group/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { EuiButtonIconProps, EuiButtonPropsForButtonOrLink } from '@elastic/eui';
import { IconType } from '../icon';
import { CommonProps } from '../common';
import { FunctionComponent, ReactNode, ReactPropTypes } from 'react';
import {
AnchorHTMLAttributes,
ButtonHTMLAttributes,
FunctionComponent,
HTMLAttributes,
MouseEventHandler,
ReactElement,
ReactNode
} from 'react';

declare module '@elastic/eui' {
/**
Expand All @@ -10,7 +18,7 @@ declare module '@elastic/eui' {
* @see './list_group.js'
*/

type EuiListGroupProps = CommonProps & {
type EuiListGroupProps = CommonProps & HTMLAttributes<HTMLUListElement> & {
bordered?: boolean;
flush?: boolean;
listItems?: FunctionComponent<EuiListGroupItemProps>[];
Expand All @@ -27,14 +35,14 @@ declare module '@elastic/eui' {
* @see './list_group_item.js'
*/

type EuiListGroupItemProps = CommonProps & {
type EuiListGroupItemProps = {
size?: 'xs' | 's' | 'm' | 'l';
label: ReactNode;
isActive?: boolean;
isDisabled?: boolean;
href?: string;
iconType?: IconType;
icon?: ReactPropTypes['element'];
icon?: ReactElement;
showToolTip?: boolean;
extraAction?: EuiButtonPropsForButtonOrLink<
CommonProps &
Expand All @@ -47,5 +55,16 @@ declare module '@elastic/eui' {
wrapText?: boolean;
};

export const EuiListGroupItem: FunctionComponent<EuiListGroupItemProps>;
type EuiListGroupItemExtendedProps = EuiListGroupItemProps & CommonProps & (
({
onClick: MouseEventHandler<HTMLButtonElement>;
} & ButtonHTMLAttributes<HTMLButtonElement>) |
({
href: string;
onClick: MouseEventHandler<HTMLAnchorElement>;
} & AnchorHTMLAttributes<HTMLAnchorElement>) |
HTMLAttributes<HTMLSpanElement>
);

export const EuiListGroupItem: FunctionComponent<EuiListGroupItemExtendedProps>;
}

0 comments on commit 64f9e6f

Please sign in to comment.