Skip to content

Commit

Permalink
[EuIContextMenuItem] Remove deprecated toolTipTitle and `toolTipPos…
Browse files Browse the repository at this point in the history
…ition` props (#7489)
  • Loading branch information
cee-chen authored Jan 29, 2024
1 parent ede1b4a commit 6f38886
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 33 deletions.
3 changes: 3 additions & 0 deletions changelogs/upcoming/7489.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Breaking changes**

- Removed deprecated `toolTipTitle` and `toolTipPosition` props from `EuiContextMenuItem`. Use `toolTipProps.title` and `toolTilProps.position` instead
8 changes: 5 additions & 3 deletions src-docs/src/views/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ export default () => {
{
name: 'Add a tooltip',
icon: 'document',
toolTipTitle: 'Optional tooltip',
toolTipContent: 'Optional content for a tooltip',
toolTipPosition: 'right',
toolTipProps: {
title: 'Optional tooltip title',
position: 'right',
},
onClick: closePopover,
},
{
Expand All @@ -78,7 +80,7 @@ export default () => {
name: 'Disabled option',
icon: 'user',
toolTipContent: 'For reasons, this item is disabled',
toolTipPosition: 'right',
toolTipProps: { position: 'right' },
disabled: true,
onClick: closePopover,
},
Expand Down
8 changes: 5 additions & 3 deletions src/components/context_menu/context_menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ const panels: EuiContextMenuProps['panels'] = [
{
name: 'Add a tooltip',
icon: 'document',
toolTipTitle: 'Optional tooltip',
toolTipContent: 'Optional content for a tooltip',
toolTipPosition: 'right',
toolTipProps: {
title: 'Optional tooltip title',
position: 'right',
},
onClick: noop,
},
{
Expand All @@ -72,7 +74,7 @@ const panels: EuiContextMenuProps['panels'] = [
name: 'Disabled option',
icon: 'user',
toolTipContent: 'For reasons, this item is disabled',
toolTipPosition: 'right',
toolTipProps: { position: 'right' },
disabled: true,
onClick: noop,
},
Expand Down
13 changes: 1 addition & 12 deletions src/components/context_menu/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,7 @@ export class EuiContextMenuClass extends Component<
return <EuiHorizontalRule key={key} margin="none" {...rest} />;
}

const {
panel,
name,
key,
icon,
onClick,
toolTipTitle,
toolTipContent,
...rest
} = item;
const { panel, name, key, icon, onClick, ...rest } = item;

const onClickHandler = panel
? (event: React.MouseEvent) => {
Expand All @@ -351,8 +342,6 @@ export class EuiContextMenuClass extends Component<
icon={icon}
onClick={onClickHandler}
hasPanel={Boolean(panel)}
toolTipTitle={toolTipTitle}
toolTipContent={toolTipContent}
{...rest}
>
{name}
Expand Down
2 changes: 0 additions & 2 deletions src/components/context_menu/context_menu_item.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ describe('EuiContextMenuItem', () => {
const { getByRole, baseElement } = render(
<EuiContextMenuItem
toolTipContent="tooltip content"
toolTipTitle="overridden"
// Should override the deprecated props
toolTipProps={{ title: 'Test', position: 'top', delay: 'long' }}
>
Hello
Expand Down
15 changes: 2 additions & 13 deletions src/components/context_menu/context_menu_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { validateHref } from '../../services/security/href_validator';
import { CommonProps, keysOf } from '../common';
import { EuiIcon } from '../icon';
import { EuiToolTip, EuiToolTipProps, ToolTipPositions } from '../tool_tip';
import { EuiToolTip, EuiToolTipProps } from '../tool_tip';

import { euiContextMenuItemStyles } from './context_menu_item.styles';

Expand All @@ -53,14 +53,6 @@ export interface EuiContextMenuItemProps
* Accepts any prop that EuiToolTip does, except for `content` and `children`.
*/
toolTipProps?: Partial<Omit<EuiToolTipProps, 'content' | 'children'>>;
/**
* @deprecated Use toolTipProps.title instead
*/
toolTipTitle?: ReactNode;
/**
* @deprecated Use tooltipProps.position instead
*/
toolTipPosition?: ToolTipPositions;
href?: string;
target?: string;
rel?: string;
Expand Down Expand Up @@ -99,9 +91,7 @@ export const EuiContextMenuItem: FunctionComponent<Props> = ({
buttonRef,
disabled: _disabled,
layoutAlign = 'center',
toolTipTitle,
toolTipContent,
toolTipPosition = 'right',
toolTipProps,
href,
target,
Expand Down Expand Up @@ -215,8 +205,7 @@ export const EuiContextMenuItem: FunctionComponent<Props> = ({
);
return (
<EuiToolTip
title={toolTipTitle ? toolTipTitle : null}
position={toolTipPosition}
position="right"
{...toolTipProps}
anchorClassName={anchorClasses}
content={toolTipContent}
Expand Down

0 comments on commit 6f38886

Please sign in to comment.