@plteam/chat-ui
Version:
CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript
25 lines (24 loc) • 1.36 kB
JavaScript
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Tooltip from '@mui/material/Tooltip';
import { UnfoldLessIcon, UnfoldMoreIcon } from '../../icons';
import { useLocalizationContext } from '../core/LocalizationContext';
import { useChatCoreSlots } from '../core/ChatSlotsContext';
import { motion } from '../../utils/materialDesign/motion';
import { ChatViewConstants } from '../../views/ChatViewConstants';
const DivStyled = styled('div')(({ theme }) => ({
position: 'absolute',
top: 8,
right: 8,
transition: theme.transitions.create('opacity', { duration: motion.duration.short4 }),
width: ChatViewConstants.INPUT_BUTTON_SIZE,
height: ChatViewConstants.INPUT_BUTTON_SIZE,
}));
const TextFieldExpandButton = ({ expand, onClick, show }) => {
const locale = useLocalizationContext();
const coreSlots = useChatCoreSlots();
return (React.createElement(DivStyled, { style: { opacity: show ? 1 : 0, zIndex: show ? 99 : 0 } },
React.createElement(Tooltip, { title: locale.innerRowExpand },
React.createElement(coreSlots.iconButton, { sx: { transform: 'rotate(45deg)' }, disabled: !show, onClick: onClick }, expand ? React.createElement(UnfoldLessIcon, null) : React.createElement(UnfoldMoreIcon, null)))));
};
export default TextFieldExpandButton;