2023-12-28 13:03:21 +00:00
|
|
|
import {
|
|
|
|
InvPopover,
|
|
|
|
InvPopoverAnchor,
|
|
|
|
InvPopoverBody,
|
|
|
|
InvPopoverContent,
|
|
|
|
} from 'common/components/InvPopover/wrapper';
|
|
|
|
import { EmbeddingSelect } from 'features/embedding/EmbeddingSelect';
|
|
|
|
import type { EmbeddingPopoverProps } from 'features/embedding/types';
|
2023-12-29 03:05:56 +00:00
|
|
|
import { memo } from 'react';
|
2023-12-28 13:03:21 +00:00
|
|
|
import { PARAMETERS_PANEL_WIDTH } from 'theme/util/constants';
|
|
|
|
|
2023-12-29 03:05:56 +00:00
|
|
|
export const EmbeddingPopover = memo((props: EmbeddingPopoverProps) => {
|
2023-12-28 13:03:21 +00:00
|
|
|
const {
|
|
|
|
onSelect,
|
|
|
|
isOpen,
|
|
|
|
onClose,
|
|
|
|
width = PARAMETERS_PANEL_WIDTH,
|
|
|
|
children,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<InvPopover
|
|
|
|
isOpen={isOpen}
|
|
|
|
onClose={onClose}
|
|
|
|
placement="bottom"
|
|
|
|
openDelay={0}
|
|
|
|
closeDelay={0}
|
|
|
|
closeOnBlur={true}
|
|
|
|
returnFocusOnClose={true}
|
|
|
|
isLazy
|
|
|
|
>
|
|
|
|
<InvPopoverAnchor>{children}</InvPopoverAnchor>
|
|
|
|
<InvPopoverContent
|
|
|
|
p={0}
|
|
|
|
insetBlockStart={-1}
|
|
|
|
shadow="dark-lg"
|
|
|
|
borderColor="blue.300"
|
|
|
|
borderWidth="2px"
|
|
|
|
borderStyle="solid"
|
|
|
|
>
|
|
|
|
<InvPopoverBody p={0} width={`calc(${width}px - 0.25rem)`}>
|
|
|
|
<EmbeddingSelect onClose={onClose} onSelect={onSelect} />
|
|
|
|
</InvPopoverBody>
|
|
|
|
</InvPopoverContent>
|
|
|
|
</InvPopover>
|
|
|
|
);
|
2023-12-29 03:05:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
EmbeddingPopover.displayName = 'EmbeddingPopover';
|