From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/base/input/index.tsx | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/components/base/input/index.tsx b/app/components/base/input/index.tsx index 30fd90a..044fc27 100644 --- a/app/components/base/input/index.tsx +++ b/app/components/base/input/index.tsx @@ -4,7 +4,6 @@ import { RiCloseCircleFill, RiErrorWarningLine, RiSearchLine } from '@remixicon/react' import { type VariantProps, cva } from 'class-variance-authority' import cn from '@/utils/classnames' -import { noop } from 'lodash-es' export const inputVariants = cva( '', @@ -30,7 +29,7 @@ wrapperClassName?: string styleCss?: CSSProperties unit?: string -} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> & VariantProps<typeof inputVariants> +} & React.InputHTMLAttributes<HTMLInputElement> & VariantProps<typeof inputVariants> const Input = ({ size, @@ -44,18 +43,18 @@ styleCss, value, placeholder, - onChange = noop, + onChange, unit, ...props }: InputProps) => { const { t } = useTranslation() return ( <div className={cn('relative w-full', wrapperClassName)}> - {showLeftIcon && <RiSearchLine className={cn('absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-components-input-text-placeholder')} />} + {showLeftIcon && <RiSearchLine className={cn('absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-components-input-text-placeholder')} />} <input style={styleCss} className={cn( - 'w-full appearance-none border border-transparent bg-components-input-bg-normal py-[7px] text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs', + 'w-full py-[7px] bg-components-input-bg-normal border border-transparent text-components-input-text-filled hover:bg-components-input-bg-hover hover:border-components-input-border-hover focus:bg-components-input-bg-active focus:border-components-input-border-active focus:shadow-xs placeholder:text-components-input-text-placeholder appearance-none outline-none caret-primary-600', inputVariants({ size }), showLeftIcon && 'pl-[26px]', showLeftIcon && size === 'large' && 'pl-7', @@ -63,8 +62,8 @@ showClearIcon && value && size === 'large' && 'pr-7', destructive && 'pr-[26px]', destructive && size === 'large' && 'pr-7', - disabled && 'cursor-not-allowed border-transparent bg-components-input-bg-disabled text-components-input-text-filled-disabled hover:border-transparent hover:bg-components-input-bg-disabled', - destructive && 'border-components-input-border-destructive bg-components-input-bg-destructive text-components-input-text-filled hover:border-components-input-border-destructive hover:bg-components-input-bg-destructive focus:border-components-input-border-destructive focus:bg-components-input-bg-destructive', + disabled && 'bg-components-input-bg-disabled border-transparent text-components-input-text-filled-disabled cursor-not-allowed hover:bg-components-input-bg-disabled hover:border-transparent', + destructive && 'bg-components-input-bg-destructive border-components-input-border-destructive text-components-input-text-filled hover:bg-components-input-bg-destructive hover:border-components-input-border-destructive focus:bg-components-input-bg-destructive focus:border-components-input-border-destructive', className, )} placeholder={placeholder ?? (showLeftIcon @@ -76,16 +75,16 @@ {...props} /> {showClearIcon && value && !disabled && !destructive && ( - <div className={cn('group absolute right-2 top-1/2 -translate-y-1/2 cursor-pointer p-[1px]')} onClick={onClear}> - <RiCloseCircleFill className='h-3.5 w-3.5 cursor-pointer text-text-quaternary group-hover:text-text-tertiary' /> + <div className={cn('absolute right-2 top-1/2 -translate-y-1/2 group p-[1px] cursor-pointer')} onClick={onClear}> + <RiCloseCircleFill className='w-3.5 h-3.5 text-text-quaternary cursor-pointer group-hover:text-text-tertiary' /> </div> )} {destructive && ( - <RiErrorWarningLine className='absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 text-text-destructive-secondary' /> + <RiErrorWarningLine className='absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-text-destructive-secondary' /> )} { unit && ( - <div className='system-sm-regular absolute right-2 top-1/2 -translate-y-1/2 text-text-tertiary'> + <div className='absolute right-2 top-1/2 -translate-y-1/2 system-sm-regular text-text-tertiary'> {unit} </div> ) -- Gitblit v1.8.0