@*
EN: Dark-themed auth input with label, prefix icon, and action button (e.g., password toggle).
VI: Input xác thực dark theme với label, icon prefix, và action button (VD: toggle mật khẩu).
*@
@if (Label != null || ForgotPasswordLink != null)
{
}
@if (PrefixIcon != null)
{
}
@if (InputType == "password")
{
}
@code {
private bool _showPassword = false;
private string _currentType => InputType == "password" && _showPassword ? "text" : InputType;
[Parameter] public string? Label { get; set; }
[Parameter] public string InputType { get; set; } = "text";
[Parameter] public string? Placeholder { get; set; }
[Parameter] public string? Value { get; set; }
[Parameter] public string? PrefixIcon { get; set; }
[Parameter] public string? InputId { get; set; }
[Parameter] public string? AutoComplete { get; set; }
[Parameter] public string? ForgotPasswordLink { get; set; }
[Parameter] public string ForgotPasswordText { get; set; } = "Quên mật khẩu?";
[Parameter] public EventCallback ValueChanged { get; set; }
private async Task OnInput(ChangeEventArgs e)
{
Value = e.Value?.ToString();
await ValueChanged.InvokeAsync(e);
}
private async Task OnChange(ChangeEventArgs e)
{
Value = e.Value?.ToString();
await ValueChanged.InvokeAsync(e);
}
private void TogglePassword()
{
_showPassword = !_showPassword;
}
}