Skip to content

Commit

Permalink
[Lens] Remove reference tooltip in Formula panel when the popup is op…
Browse files Browse the repository at this point in the history
…en (#103283) (#103624)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
  • Loading branch information
kibanamachine and dej611 authored Jun 29, 2021
1 parent 5f16d3e commit fd02892
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { monaco } from '@kbn/monaco';
import classNames from 'classnames';
import { CodeEditor } from '../../../../../../../../../src/plugins/kibana_react/public';
import type { CodeEditorProps } from '../../../../../../../../../src/plugins/kibana_react/public';
import { useDebounceWithOptions } from '../../../../../shared_components';
import { TooltipWrapper, useDebounceWithOptions } from '../../../../../shared_components';
import { ParamEditorProps } from '../../index';
import { getManagedColumnsFrom } from '../../../layer_helpers';
import { ErrorWrapper, runASTValidation, tryToParse } from '../validation';
Expand Down Expand Up @@ -729,11 +729,16 @@ export function FormulaEditor({
</EuiLink>
</EuiToolTip>
) : (
<EuiToolTip
content={i18n.translate('xpack.lens.formula.editorHelpOverlayToolTip', {
defaultMessage: 'Function reference',
})}
<TooltipWrapper
tooltipContent={i18n.translate(
'xpack.lens.formula.editorHelpOverlayToolTip',
{
defaultMessage: 'Function reference',
}
)}
condition={!isHelpOpen}
position="top"
delay="regular"
>
<EuiPopover
panelClassName="lnsFormula__docs lnsFormula__docs--overlay"
Expand Down Expand Up @@ -769,7 +774,7 @@ export function FormulaEditor({
operationDefinitionMap={visibleOperationsMap}
/>
</EuiPopover>
</EuiToolTip>
</TooltipWrapper>
)}
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
*/

import React from 'react';
import { EuiToolTip } from '@elastic/eui';
import { EuiToolTip, EuiToolTipProps } from '@elastic/eui';

export interface TooltipWrapperProps {
export type TooltipWrapperProps = Partial<Omit<EuiToolTipProps, 'content'>> & {
tooltipContent: string;
condition: boolean;
}
};

export const TooltipWrapper: React.FunctionComponent<TooltipWrapperProps> = ({
children,
condition,
tooltipContent,
...tooltipProps
}) => {
return (
<>
{condition ? (
<EuiToolTip content={tooltipContent} delay="long">
<EuiToolTip content={tooltipContent} delay="long" {...tooltipProps}>
<>{children}</>
</EuiToolTip>
) : (
Expand Down

0 comments on commit fd02892

Please sign in to comment.