import type { CSSProperties } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { RiCloseCircleFill, RiErrorWarningLine, RiSearchLine } from '@remixicon/react' import { type VariantProps, cva } from 'class-variance-authority' import cn from '@/utils/classnames' export const inputVariants = cva( '', { variants: { size: { regular: 'px-3 radius-md system-sm-regular', large: 'px-4 radius-lg system-md-regular', }, }, defaultVariants: { size: 'regular', }, }, ) export type InputProps = { showLeftIcon?: boolean showClearIcon?: boolean onClear?: () => void disabled?: boolean destructive?: boolean wrapperClassName?: string styleCss?: CSSProperties } & React.InputHTMLAttributes & VariantProps const Input = ({ size, disabled, destructive, showLeftIcon, showClearIcon, onClear, wrapperClassName, className, styleCss, value, placeholder, onChange, ...props }: InputProps) => { const { t } = useTranslation() return (
{showLeftIcon && } {showClearIcon && value && !disabled && !destructive && (
)} {destructive && ( )}
) } export default Input