-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
47 changes: 37 additions & 10 deletions
47
app/components/avo/fields/password_field/edit_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
<%= field_wrapper **field_wrapper_args do %> | ||
<%= @form.password_field @field.id, | ||
value: @field.value, | ||
class: classes("w-full"), | ||
data: @field.get_html(:data, view: view, element: :input), | ||
disabled: disabled?, | ||
placeholder: @field.placeholder, | ||
style: @field.get_html(:style, view: view, element: :input), | ||
autocomplete: @field.autocomplete, | ||
autofocus: @autofocus | ||
%> | ||
<% if @field.reveal %> | ||
<div class="relative" data-controller="password-visibility"> | ||
<%= @form.password_field @field.id, | ||
value: @field.value, | ||
class: classes("w-full"), | ||
data: @field.get_html(:data, view: view, element: :input).merge(password_visibility_target: "input"), | ||
disabled: disabled?, | ||
placeholder: @field.placeholder, | ||
style: @field.get_html(:style, view: view, element: :input), | ||
autocomplete: @field.autocomplete, | ||
autofocus: @autofocus | ||
%> | ||
<button data-action="password-visibility#toggle" type="button" class="text-gray-500 absolute inset-y-0 right-0 pr-3 flex items-center cursor-pointer"> | ||
<!-- Heroicon name: outline/eye --> | ||
<svg data-password-visibility-target="icon" xmlns="http://www.w3.org/2000/svg" class="size-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path> | ||
</svg> | ||
|
||
<!-- Heroicon name: outline/eye-off --> | ||
<svg data-password-visibility-target="icon" xmlns="http://www.w3.org/2000/svg" class="size-6 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"></path> | ||
</svg> | ||
</button> | ||
</div> | ||
<% else %> | ||
<%= @form.password_field @field.id, | ||
value: @field.value, | ||
class: classes("w-full"), | ||
data: @field.get_html(:data, view: view, element: :input), | ||
disabled: disabled?, | ||
placeholder: @field.placeholder, | ||
style: @field.get_html(:style, view: view, element: :input), | ||
autocomplete: @field.autocomplete, | ||
autofocus: @autofocus | ||
%> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters