InvokeAI/invokeai/frontend/web/src/features/prompt/PromptPopover.tsx

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

38 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Popover, PopoverAnchor, PopoverBody, PopoverContent } from '@invoke-ai/ui-library';
import { PromptTriggerSelect } from 'features/prompt/PromptTriggerSelect';
import type { PromptPopoverProps } from 'features/prompt/types';
2023-12-29 03:05:56 +00:00
import { memo } from 'react';
export const PromptPopover = memo((props: PromptPopoverProps) => {
2024-01-20 00:04:19 +00:00
const { onSelect, isOpen, onClose, width, children } = props;
return (
2024-01-20 00:04:19 +00:00
<Popover
isOpen={isOpen}
onClose={onClose}
placement="bottom"
openDelay={0}
closeDelay={0}
closeOnBlur={true}
returnFocusOnClose={false}
isLazy
>
2024-01-20 00:04:19 +00:00
<PopoverAnchor>{children}</PopoverAnchor>
<PopoverContent
p={0}
insetBlockStart={-1}
shadow="dark-lg"
borderColor="invokeBlue.300"
borderWidth="2px"
borderStyle="solid"
>
2024-01-20 00:04:19 +00:00
<PopoverBody p={0} width={`calc(${width}px - 0.25rem)`}>
<PromptTriggerSelect onClose={onClose} onSelect={onSelect} />
2024-01-20 00:04:19 +00:00
</PopoverBody>
</PopoverContent>
</Popover>
);
2023-12-29 03:05:56 +00:00
});
PromptPopover.displayName = 'PromptPopover';