import React, {ChangeEvent, FC, useState} from 'react'; // components import Typography from '../Typography'; import CustomTooltip from '../CustomTooltip'; import Button from '../Button'; // icon import Search from '../../../assets/images/input/search'; import Cancel from '../../../assets/images/input/cancel'; import VideoInfo from '../../../assets/images/modal-icons/info'; import ToolCancel from '../../../assets/images/modal-icons/tool-cancel'; import CancelInput from '../../../assets/images/modal-icons/cancel-input'; // styles import './styles.scss'; const errorStyles = { color: 'var(--error-color)', fontWeight: '400', fontSize: '14px', margin: "0" }; interface InputProps { variant?: keyof JSX.IntrinsicElements; type: any; value: string, onChange: ( e: ChangeEvent ) => void; placeholder?: string; label?: string; error?: string; inputIcon?: boolean; searchApplied?: boolean; onClick?: () => void; removeSearchInput?: () => void; onKeyDown?: () => void; builderInput?: boolean; gellerySearch?: boolean; videoTooltip?: boolean; handleFileRemove?: () => void; qrField?: boolean; onlyNumber?: boolean; currentTheme?: string | null | undefined; required?: boolean; isClearable?: boolean; className?: string; } const Input: FC = ({ variant = 'input', type, value, onChange, placeholder, label, error, inputIcon = false, onClick, searchApplied, removeSearchInput, onKeyDown, builderInput, gellerySearch = false, videoTooltip = false, handleFileRemove, qrField = false, onlyNumber = false, currentTheme = '', required = false, isClearable = false, className = '' }) => { const InputVariant = variant || 'input'; const [showTooltip, setShowTooltip] = useState(false); const loomButtonStyles = { backgroundColor: 'var(--primary-color)', fontSize: '12px', padding: '10px 20px', borderRadius: '4px', maxHeight: '25px', }; const URLTooltip = (

You can use Loom to create this video. Create your free Loom account now.

setShowTooltip(false)}/>
); const handleClose = () => { setShowTooltip(false); }; return ( <> {currentTheme === 'v2' ? (
{type === 'file' ? ( onChange(e)} accept=".png, .jpg, .jpeg, .pdf, .doc, .docx" multiple className={`basic-input ${builderInput && 'builder-input'}`} /> ) : ( { if (event.key === 'e' || event.key === 'E' || event.key === '-' || event.key === '+') { event.preventDefault(); } } : onKeyDown} style={{ fontSize: label === 'Template Name' ? '16px' : 'inherit', color: label === 'Template Name' ? '#000000' : 'inherit', }} /> )} {inputIcon && ( <> {searchApplied && value?.length > 0 ? (
) : null}
0 ? onClick : () => {}} >
)} {(isClearable && value?.length > 0) && (
)}
{error && ( * {error} )}
) : (
{type === 'file' ? ( onChange(e)} accept=".png, .jpg, .jpeg, .pdf, .doc, .docx" multiple className={`basic-input ${builderInput && 'builder-input'}`} /> ) : ( { if (event.key === 'e' || event.key === 'E' || event.key === '-' || event.key === '+') { event.preventDefault(); } } : onKeyDown} /> )} {inputIcon && ( <> {searchApplied && value?.length > 0 ? (
) : null}
0 ? onClick : () => {}} >
)}
{error && ( * {error} )}
) } ); }; export default Input;