| | 1 | | @namespace Syki.Front.Components.Passwords |
| | 2 | |
|
| | 3 | | <MudTextField |
| | 4 | | Margin="Margin.Dense" |
| | 5 | | Adornment="Adornment.End" |
| | 6 | | AdornmentIcon="@_passwordIcon" |
| | 7 | | OnAdornmentClick="@PasswordIconClick" |
| | 8 | | InputType="@_passwordInputType" |
| | 9 | | Label="Senha" |
| | 10 | | Class="@Class" |
| | 11 | | Immediate="true" |
| | 12 | | OnlyValidateIfDirty="true" |
| | 13 | | Value="@Value" |
| | 14 | | ValueChanged="@ValueChanged" |
| | 15 | | Variant="Variant.Outlined" |
| | 16 | | Required="@Required" |
| | 17 | | RequiredError="Informe!" |
| | 18 | | /> |
| | 19 | |
|
| | 20 | | @code |
| | 21 | | { |
| | 22 | | [Parameter] |
| 0 | 23 | | public bool Required { get; set; } |
| | 24 | |
|
| | 25 | | [Parameter] |
| 0 | 26 | | public string Value { get; set; } |
| | 27 | |
|
| | 28 | | [Parameter] |
| 0 | 29 | | public string Class { get; set; } |
| | 30 | |
|
| | 31 | | [Parameter] |
| 0 | 32 | | public EventCallback<string> ValueChanged { get; set; } |
| | 33 | |
|
| | 34 | | private bool _showPassword; |
| 0 | 35 | | private InputType _passwordInputType = InputType.Password; |
| 0 | 36 | | private string _passwordIcon = Icons.Material.Filled.VisibilityOff; |
| | 37 | |
|
| | 38 | | private void PasswordIconClick() |
| | 39 | | { |
| 0 | 40 | | @if (_showPassword) |
| | 41 | | { |
| 0 | 42 | | _showPassword = false; |
| 0 | 43 | | _passwordIcon = Icons.Material.Filled.VisibilityOff; |
| 0 | 44 | | _passwordInputType = InputType.Password; |
| | 45 | | } |
| | 46 | | else |
| | 47 | | { |
| 0 | 48 | | _showPassword = true; |
| 0 | 49 | | _passwordIcon = Icons.Material.Filled.Visibility; |
| 0 | 50 | | _passwordInputType = InputType.Text; |
| | 51 | | } |
| 0 | 52 | | } |
| | 53 | | } |