/** @jsxRuntime classic */ /** @jsx jsx */ import React, { FC, useState, useRef } from 'react'; import { Icons } from '../../types/theme'; import cx from 'classnames'; import { jsx, Theme, useTheme } from '@emotion/react'; import { StyledInput, DeleteButtonStyle, InputContainer } from './style'; import { getIcon, BnRemove } from '../../icons'; import { capitalize } from '../../functions'; import { Tooltip } from '../Tooltip'; import { ErrorMessage } from '../ErrorMessage'; export interface InputProps { placeholder?: string; label?: string; info?: string; helper?: string; helperContent?: string; sizer: 'M' | 'S'; leftIcon?: Icons; rightIcon?: Icons; error?: string | undefined; setChange?: (val: string | number) => void; disableTrailing?: boolean; clear?: () => void; // colors?: IColors; } export const Textarea: FC< InputProps & React.TextareaHTMLAttributes > = ({ leftIcon = '', rightIcon = '', children, sizer = 'S', label = '', info = '', helper = '', helperContent = '', error = undefined, disableTrailing = true, setChange = () => {}, clear = () => {}, // colors = ThemeColors, ...rest }) => { const [isFocus, setFocus] = useState(false); const [innerValue, setInnerValue] = useState(''); const [isHover, setHover] = useState(false); const [visited, setVisited] = useState(false); const inputRef = useRef(null); const colors = useTheme(); // const { colors: ThemeC } = useColors(); return ( {label && (
{capitalize(label)} {rest.required && ' *'}
{info && {getIcon('info', 'l')}}
)} { if (inputRef.current) { //@ts-ignore inputRef.current.focus(); } }} onMouseEnter={() => { setHover(true); }} onMouseLeave={() => { setHover(false); }} > {leftIcon && getIcon(leftIcon, 'r')}