Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
21 changes: 12 additions & 9 deletions src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {
ButtonHTMLAttributes,
FunctionComponent,
HTMLAttributes,
MouseEventHandler,
ReactNode,
Ref,
} from 'react';
Expand All @@ -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
*/
Expand Down Expand Up @@ -45,13 +44,15 @@ export interface EuiPanelProps {
betaBadgeTitle?: string;
}

type Divlike = Omit<HTMLAttributes<HTMLDivElement>, 'onClick'>;
interface Divlike
extends EuiPanelProps,
Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {}

interface Buttonlike {
onClick?: MouseEventHandler<HTMLButtonElement>;
}
interface Buttonlike
extends EuiPanelProps,
ButtonHTMLAttributes<HTMLButtonElement> {}

type Props = CommonProps & EuiPanelProps & ExclusiveUnion<Divlike, Buttonlike>;
type Props = ExclusiveUnion<Divlike, Buttonlike>;

const paddingSizeToClassNameMap = {
none: null,
Expand Down Expand Up @@ -115,8 +116,10 @@ export const EuiPanel: FunctionComponent<Props> = ({
}

return (
// ts-ignore seems to be some div / button confusion here
<div ref={panelRef} className={classes} {...rest}>
<div
ref={panelRef as Ref<HTMLDivElement>}
className={classes}
{...rest as HTMLAttributes<HTMLDivElement>}>
{optionalBetaBadge}
{children}
</div>
Expand Down