oa-login-password-recovery-ux 改进登录找回密码体验

这个提交包含在:
2026-05-26 20:03:47 +08:00
父节点 311c732679
当前提交 cea5fb03c1
共修改 18 个文件,包含 753 行新增和 17 行删除
@@ -0,0 +1,41 @@
import { Eye, EyeOff } from "lucide-react";
import * as React from "react";
import { cn } from "../../lib/utils";
import { Button } from "./button";
import { Input, type InputProps } from "./input";
export type PasswordInputProps = Omit<InputProps, "type"> & {
revealLabel?: string;
hideLabel?: string;
};
export const PasswordInput = React.forwardRef<HTMLInputElement, PasswordInputProps>(
({ className, revealLabel = "显示密码", hideLabel = "隐藏密码", ...props }, ref) => {
const [visible, setVisible] = React.useState(false);
const Icon = visible ? EyeOff : Eye;
const label = visible ? hideLabel : revealLabel;
return (
<div className="relative">
<Input
{...props}
ref={ref}
type={visible ? "text" : "password"}
className={cn("pr-11", className)}
/>
<Button
type="button"
variant="ghost"
size="icon"
aria-label={label}
className="absolute right-1 top-1/2 h-8 w-8 -translate-y-1/2 text-slate-500 hover:text-primary"
onClick={() => setVisible((current) => !current)}
>
<Icon aria-hidden="true" className="h-4 w-4" />
</Button>
</div>
);
},
);
PasswordInput.displayName = "PasswordInput";