Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

1.1 KB
Raw Blame
import { Popover, PopoverAnchor, PopoverBody, PopoverContent, Portal } from '@invoke-ai/ui-library';
import { PromptTriggerSelect } from 'features/prompt/PromptTriggerSelect';
import type { PromptPopoverProps } from 'features/prompt/types';
import { memo } from 'react';

export const PromptPopover = memo((props: PromptPopoverProps) => {
  const { onSelect, isOpen, onClose, width, children } = props;

  return (
    <Popover
      isOpen={isOpen}
      onClose={onClose}
      placement="bottom"
      openDelay={0}
      closeDelay={0}
      closeOnBlur={true}
      returnFocusOnClose={false}
      isLazy
    >
      <PopoverAnchor>{children}</PopoverAnchor>
      <Portal>
        <PopoverContent
          p={0}
          insetBlockStart={-1}
          shadow="dark-lg"
          borderColor="invokeBlue.300"
          borderWidth="2px"
          borderStyle="solid"
        >
          <PopoverBody p={0} width={`calc(${width}px - 0.25rem)`}>
            <PromptTriggerSelect onClose={onClose} onSelect={onSelect} />
          </PopoverBody>
        </PopoverContent>
      </Portal>
    </Popover>
  );
});

PromptPopover.displayName = 'PromptPopover';