Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuIContextMenuItem] Remove deprecated toolTipTitle and toolTipPosition props #7489

Merged
merged 4 commits into from
Jan 29, 2024
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
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
Loading