From f54d4adbffc7228e1d42866b4ced18f63fc17f7d Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Wed, 11 Sep 2019 12:49:40 -0500 Subject: [PATCH 1/2] fix euipanel exclusiveunion --- src/components/panel/panel.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/panel/panel.tsx b/src/components/panel/panel.tsx index 283adac1837..979de447969 100644 --- a/src/components/panel/panel.tsx +++ b/src/components/panel/panel.tsx @@ -2,7 +2,6 @@ import React, { ButtonHTMLAttributes, FunctionComponent, HTMLAttributes, - MouseEventHandler, ReactNode, Ref, } from 'react'; @@ -13,7 +12,7 @@ import { EuiBetaBadge } from '../badge/beta_badge'; export type PanelPaddingSize = 'none' | 's' | 'm' | 'l'; -export interface EuiPanelProps { +export interface EuiPanelProps extends CommonProps { /** * If active, adds a deeper shadow to the panel */ @@ -45,13 +44,15 @@ export interface EuiPanelProps { betaBadgeTitle?: string; } -type Divlike = Omit, 'onClick'>; +interface Divlike + extends EuiPanelProps, + Omit, 'onClick'> {} -interface Buttonlike { - onClick?: MouseEventHandler; -} +interface Buttonlike + extends EuiPanelProps, + ButtonHTMLAttributes {} -type Props = CommonProps & EuiPanelProps & ExclusiveUnion; +type Props = ExclusiveUnion; const paddingSizeToClassNameMap = { none: null, @@ -115,8 +116,10 @@ export const EuiPanel: FunctionComponent = ({ } return ( - // ts-ignore seems to be some div / button confusion here -
+
} + className={classes} + {...rest as HTMLAttributes}> {optionalBetaBadge} {children}
From 3d26557343cb7d86174036a16f29c04b88880486 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Wed, 11 Sep 2019 13:00:49 -0500 Subject: [PATCH 2/2] CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c751602e84..221e66a51e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ **Bug fixes** - Corrected `EuiCodeBlock`'s proptype for `children` to be string or array of strings. ([#2324](https://github.com/elastic/eui/pull/2324)) +- Fixed `onClick` TypeScript definition for `EuiPanel` ([#2330](https://github.com/elastic/eui/pull/2330)) ## [`13.8.1`](https://github.com/elastic/eui/tree/v13.8.1)