using Microsoft.AspNetCore.Components;

namespace Connected.Components;
public partial class InputPassword: InputBase
{

	[Parameter]
   public string Value { get; set; }


    [Parameter]
    public EventCallback<string> ValueChanged { get; set; }

    private async Task ChangeValueAsync(ChangeEventArgs args)
    {
        await ValueChanged.InvokeAsync(args.Value.ToString());
			StateHasChanged();
    }

	private async Task Clear()
	{
		await ValueChanged.InvokeAsync(string.Empty);
	}

	protected override async Task OnInitializedAsync()
    {
		if (base.InputAttributes is null) base.InputAttributes = new();
		if (base.Required)
		{
			if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true);
		}
		await base.OnInitializedAsync();
    }

}