// ============================================================================ // Chatbot Toggle // ============================================================================ import type { Ref, FunctionComponent } from 'react'; import { forwardRef } from 'react'; import { Button, ButtonProps, Tooltip, TooltipProps, Icon } from '@patternfly/react-core'; import AngleDownIcon from '@patternfly/react-icons/dist/esm/icons/angle-down-icon'; export interface ChatbotToggleProps extends ButtonProps { /** Contents of the tooltip applied to the toggle button */ tooltipLabel: React.ReactNode; /** Props spread to the PF Tooltip component */ tooltipProps?: Omit; /** Flag indicating visibility of the chatbot appended to the toggle */ isChatbotVisible?: boolean; /** Callback fired when toggle button is clicked */ onToggleChatbot?: () => void; /** Accessible label for the toggle button */ toggleButtonLabel?: string; /** An image displayed in the chatbot toggle when it is closed */ closedToggleIcon?: () => JSX.Element; /** Ref applied to toggle */ innerRef?: React.Ref; /** Whether toggle is a circle */ isRound?: boolean; /** Class name applied to toggle */ className?: string; /** Test id applied to default open icon */ openIconTestId?: string; } const ChatIcon = () => ( ); const ChatbotToggleBase: FunctionComponent = ({ tooltipLabel, isChatbotVisible, onToggleChatbot, tooltipProps, toggleButtonLabel, closedToggleIcon: ClosedToggleIcon, innerRef, isRound = true, className, openIconTestId, ...props }: ChatbotToggleProps) => { // Configure icon const closedIcon = ClosedToggleIcon ? : ; const icon = isChatbotVisible ? : closedIcon; return ( ); }; const ChatbotToggle = forwardRef((props: ChatbotToggleProps, ref: Ref) => ( )); export default ChatbotToggle;