import React, { useState, useCallback } from 'react'; import { Testable, useBuildTestId } from '../../modules/testing'; import { Tooltip } from '../Tooltip'; import { Context, ContentContext } from './context'; import { TargetContainer, TooltipContent } from './styled'; export type TriggerValue = 'mouseenter' | 'focus' | 'click'; export type Props = Pick, 'className' | 'children'> & Testable & { target: React.ReactNode; }; export const Component = ({ children, className, target, 'data-testid': testId, ...otherProps }: Props) => { const [isShowing, setIsShowing] = useState(false); const { buildTestId } = useBuildTestId({ id: testId }); const toggle = useCallback(() => { setIsShowing((value) => !value); }, []); return ( {children} } data-testid={buildTestId('')} onClickOutside={toggle} > {target} ); }; Component.displayName = 'Dropdown';