Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use filament revealable flag on input instead #10

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use filament's new reveal functionality
  • Loading branch information
rawilk committed Jan 22, 2024
commit 173e0f070b952db9875a6aa2b82c152af9184ae1
16 changes: 0 additions & 16 deletions resources/views/partials/load-css.blade.php

This file was deleted.

134 changes: 0 additions & 134 deletions resources/views/password.blade.php

This file was deleted.

94 changes: 0 additions & 94 deletions src/Concerns/CanRevealPassword.php

This file was deleted.

25 changes: 21 additions & 4 deletions src/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,35 @@
use Filament\Forms\Components\TextInput;
use Rawilk\FilamentPasswordInput\Concerns\CanCopyToClipboard;
use Rawilk\FilamentPasswordInput\Concerns\CanRegeneratePassword;
use Rawilk\FilamentPasswordInput\Concerns\CanRevealPassword;

class Password extends TextInput
{
use CanCopyToClipboard;
use CanRegeneratePassword;
use CanRevealPassword;

protected string $view = 'filament-password-input::password';

protected bool|Closure $hidePasswordManagerIcons = false;

protected function setUp(): void
{
parent::setUp();

$this->password();

$this->revealable();
}

public function getExtraInputAttributes(): array
{
$extraAttributes = parent::getExtraInputAttributes();

if ($this->shouldHidePasswordManagerIcons()) {
$extraAttributes['data-1p-ignore'] = '';
$extraAttributes['data-lpignore'] = 'true';
}

return $extraAttributes;
}

/**
* Prevent password managers like 1password or LastPass from injecting buttons
* into the password field.
Expand Down
94 changes: 0 additions & 94 deletions tests/Concerns/CanRevealPasswordTest.php

This file was deleted.

Loading