InvokeAI/invokeai/frontend/web/src/features/embedding/EmbeddingPopover.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.2 KiB
TypeScript
Raw Normal View History

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';
import { PARAMETERS_PANEL_WIDTH } from 'theme/util/constants';
2023-12-29 03:05:56 +00:00
export const EmbeddingPopover = memo((props: EmbeddingPopoverProps) => {
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';