import { memo, useState } from 'react' import { Eye, EyeOff } from 'lucide-react' import i18n from '@/i18n' import { Input } from '@/components/ui/input' interface PasswordInputProps extends Omit, 'type'> { /** 明文切换按钮(密钥类字段默认开启) */ toggleable?: boolean } /** * 密码/密钥输入框 — 带明文切换。 * 供 Hosts(SSH 密码/密钥口令)、Storage(secretKey)等敏感字段复用。 */ export const PasswordInput = memo(function PasswordInput({ toggleable = true, className, ...props }: PasswordInputProps) { const [visible, setVisible] = useState(false) return (
{toggleable && ( )}
) }) export default PasswordInput