From 291e4218b69727a435541be7f2fd9e81f208551a Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 20 Aug 2025 15:03:33 +0200 Subject: [PATCH 1/7] Update to Filament v4 --- composer.json | 16 ++++++++-------- src/Actions/CopyToClipboardAction.php | 4 ++-- src/Actions/RegeneratePasswordAction.php | 6 +++--- src/Concerns/CanRegeneratePassword.php | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 82e95f2..483ad8b 100644 --- a/composer.json +++ b/composer.json @@ -20,18 +20,18 @@ } ], "require": { - "php": "^8.1", - "filament/forms": "^3.2", - "illuminate/contracts": "^10.0|^11.0|^12.0", + "php": "^8.2", + "filament/forms": "^4.0", + "illuminate/contracts": "^11.0|^12.0", "spatie/laravel-package-tools": "^1.14" }, "require-dev": { "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.9|^8.0", - "orchestra/testbench": "^8.8|^9.0|^10.0", - "pestphp/pest": "^2.20|^3.7", - "pestphp/pest-plugin-laravel": "^2.2|^3.1", - "pestphp/pest-plugin-livewire": "^2.1|^3.0", + "nunomaduro/collision": "^8.0", + "orchestra/testbench": "^9.0|^10.0", + "pestphp/pest": "^3.7", + "pestphp/pest-plugin-laravel": "^3.1", + "pestphp/pest-plugin-livewire": "^3.0", "spatie/laravel-ray": "^1.31" }, "autoload": { diff --git a/src/Actions/CopyToClipboardAction.php b/src/Actions/CopyToClipboardAction.php index 705f8f8..f47a92e 100644 --- a/src/Actions/CopyToClipboardAction.php +++ b/src/Actions/CopyToClipboardAction.php @@ -4,8 +4,8 @@ namespace Rawilk\FilamentPasswordInput\Actions; -use Filament\Forms\Components\Actions\Action; -use Filament\Forms\Components\Component; +use Filament\Actions\Action; +use Filament\Schemas\Components\Component; use Filament\Support\Facades\FilamentIcon; use Illuminate\Support\Js; diff --git a/src/Actions/RegeneratePasswordAction.php b/src/Actions/RegeneratePasswordAction.php index fdcf91c..6e27c86 100644 --- a/src/Actions/RegeneratePasswordAction.php +++ b/src/Actions/RegeneratePasswordAction.php @@ -5,10 +5,10 @@ namespace Rawilk\FilamentPasswordInput\Actions; use Closure; +use Filament\Actions\Action; use Filament\Actions\Concerns\CanCustomizeProcess; -use Filament\Forms\Components\Actions\Action; -use Filament\Forms\Components\Component; -use Filament\Forms\Set; +use Filament\Schemas\Components\Component; +use Filament\Schemas\Components\Utilities\Set; use Filament\Support\Facades\FilamentIcon; use Illuminate\Support\Str; diff --git a/src/Concerns/CanRegeneratePassword.php b/src/Concerns/CanRegeneratePassword.php index f1821f7..63797d6 100644 --- a/src/Concerns/CanRegeneratePassword.php +++ b/src/Concerns/CanRegeneratePassword.php @@ -8,7 +8,7 @@ use Rawilk\FilamentPasswordInput\Actions\RegeneratePasswordAction; /** - * @mixin \Filament\Forms\Components\Component + * @mixin \Filament\Schemas\Components\Component */ trait CanRegeneratePassword { From c56ebafd9bfb1b97268f7f21c829bf3a9eda2d4a Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 20 Aug 2025 15:05:49 +0200 Subject: [PATCH 2/7] Update UPGRADE.md --- upgrade.md => UPGRADE.md | 7 +++++++ 1 file changed, 7 insertions(+) rename upgrade.md => UPGRADE.md (95%) diff --git a/upgrade.md b/UPGRADE.md similarity index 95% rename from upgrade.md rename to UPGRADE.md index 32610a9..5d06844 100644 --- a/upgrade.md +++ b/UPGRADE.md @@ -1,5 +1,12 @@ # Upgrade Guide +## Upgrade to 3.0 from 2.x + +### Breaking changes +* This package now requires [Filament](https://filamentphp.com) 4.0 or greater. +* This package now requires Laravel 11 or greater. + + ## Upgrading to 2.0 from 1.x I've attempted to document every breaking change, however I may have missed some. If you're having an issue upgrading, please raise an issue and/or PR an update to the upgrade guide if applicable. From 994c0f36eef62f53448a28eec6b1847c3646d4a0 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 20 Aug 2025 15:18:31 +0200 Subject: [PATCH 3/7] Align the copyable method with Filament's one --- UPGRADE.md | 10 ++++++++++ src/Concerns/CanCopyToClipboard.php | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index 5d06844..dfa349b 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -5,6 +5,16 @@ ### Breaking changes * This package now requires [Filament](https://filamentphp.com) 4.0 or greater. * This package now requires Laravel 11 or greater. +* Change the `copyable()` method parameters to align with the new Filament copyable method: +```php +Password::make() + ->copyable( + condition: true, + copyMessage: 'Copied', + copyMessageDuration: 2000, + color: 'primary', + ), +``` ## Upgrading to 2.0 from 1.x diff --git a/src/Concerns/CanCopyToClipboard.php b/src/Concerns/CanCopyToClipboard.php index caeeec7..fee79a6 100644 --- a/src/Concerns/CanCopyToClipboard.php +++ b/src/Concerns/CanCopyToClipboard.php @@ -18,8 +18,13 @@ trait CanCopyToClipboard public function copyable( bool|Closure $condition = true, + string|Closure|null $copyMessage = null, + int|Closure|null $copyMessageDuration = null, string|array|Closure|null $color = null, ): static { + $this->copyMessage = $copyMessage; + $this->copyMessageDuration = $copyMessageDuration; + $action = CopyToClipboardAction::make()->visible($condition); if ($color) { From 72d0c6971e6197392d1b209d6ee9359ef80ae101 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 20 Aug 2025 15:33:12 +0200 Subject: [PATCH 4/7] Fix isDisabled()) --- src/Actions/CopyToClipboardAction.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Actions/CopyToClipboardAction.php b/src/Actions/CopyToClipboardAction.php index f47a92e..f0cc764 100644 --- a/src/Actions/CopyToClipboardAction.php +++ b/src/Actions/CopyToClipboardAction.php @@ -8,6 +8,8 @@ use Filament\Schemas\Components\Component; use Filament\Support\Facades\FilamentIcon; use Illuminate\Support\Js; +use Rawilk\FilamentPasswordInput\Concerns\CanCopyToClipboard; +use Rawilk\FilamentPasswordInput\Concerns\CanRegeneratePassword; class CopyToClipboardAction extends Action { @@ -59,6 +61,6 @@ public function isHidden(): bool return true; } - return $this->getComponent()->isDisabled(); + return $this->isDisabled(); } } From 92c7d764e416544995f9d6a8258af31592044493 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 26 Aug 2025 11:06:14 +0200 Subject: [PATCH 5/7] Fix action visibility --- src/Actions/CopyToClipboardAction.php | 5 ++--- src/Actions/RegeneratePasswordAction.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Actions/CopyToClipboardAction.php b/src/Actions/CopyToClipboardAction.php index f0cc764..2624b32 100644 --- a/src/Actions/CopyToClipboardAction.php +++ b/src/Actions/CopyToClipboardAction.php @@ -8,8 +8,6 @@ use Filament\Schemas\Components\Component; use Filament\Support\Facades\FilamentIcon; use Illuminate\Support\Js; -use Rawilk\FilamentPasswordInput\Concerns\CanCopyToClipboard; -use Rawilk\FilamentPasswordInput\Concerns\CanRegeneratePassword; class CopyToClipboardAction extends Action { @@ -61,6 +59,7 @@ public function isHidden(): bool return true; } - return $this->isDisabled(); + return $this->getSchemaComponent()->isDisabled() || + $this->getSchemaComponent()->isReadOnly(); } } diff --git a/src/Actions/RegeneratePasswordAction.php b/src/Actions/RegeneratePasswordAction.php index 6e27c86..7ad7212 100644 --- a/src/Actions/RegeneratePasswordAction.php +++ b/src/Actions/RegeneratePasswordAction.php @@ -79,7 +79,7 @@ public function isHidden(): bool return true; } - return $this->getComponent()->isDisabled() || - $this->getComponent()->isReadOnly(); + return $this->getSchemaComponent()->isDisabled() || + $this->getSchemaComponent()->isReadOnly(); } } From a3dc804c9d62b986525f9107b3081d4287f98480 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 26 Aug 2025 11:08:03 +0200 Subject: [PATCH 6/7] Update icons to use Heroicon class --- src/Actions/CopyToClipboardAction.php | 3 ++- src/Actions/RegeneratePasswordAction.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Actions/CopyToClipboardAction.php b/src/Actions/CopyToClipboardAction.php index 2624b32..edfe2a9 100644 --- a/src/Actions/CopyToClipboardAction.php +++ b/src/Actions/CopyToClipboardAction.php @@ -7,6 +7,7 @@ use Filament\Actions\Action; use Filament\Schemas\Components\Component; use Filament\Support\Facades\FilamentIcon; +use Filament\Support\Icons\Heroicon; use Illuminate\Support\Js; class CopyToClipboardAction extends Action @@ -17,7 +18,7 @@ protected function setUp(): void $this->label(__('filament-password-input::password.actions.copy.tooltip')); - $this->icon(FilamentIcon::resolve('filament-password-input::copy') ?? 'heroicon-m-clipboard'); + $this->icon(FilamentIcon::resolve('filament-password-input::copy') ?? Heroicon::OutlinedClipboardDocument); $this->color('gray'); diff --git a/src/Actions/RegeneratePasswordAction.php b/src/Actions/RegeneratePasswordAction.php index 7ad7212..31725a3 100644 --- a/src/Actions/RegeneratePasswordAction.php +++ b/src/Actions/RegeneratePasswordAction.php @@ -10,6 +10,7 @@ use Filament\Schemas\Components\Component; use Filament\Schemas\Components\Utilities\Set; use Filament\Support\Facades\FilamentIcon; +use Filament\Support\Icons\Heroicon; use Illuminate\Support\Str; class RegeneratePasswordAction extends Action @@ -26,7 +27,7 @@ protected function setUp(): void $this->label(__('filament-password-input::password.actions.regenerate.tooltip')); - $this->icon(FilamentIcon::resolve('filament-password-input::regenerate') ?? 'heroicon-o-key'); + $this->icon(FilamentIcon::resolve('filament-password-input::regenerate') ?? Heroicon::OutlinedKey); $this->color('gray'); From da6782d63dbc2b93cd458df54318e68e109fcd64 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 26 Aug 2025 11:11:06 +0200 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ba48fe..7507512 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ features to your password inputs: ## Installation -> Upgrading to 2.0 from 1.x? Be sure to follow the [Upgrade](https://github.com/rawilk/filament-password-input/blob/main/upgrade.md) guide for breaking changes. +> Upgrading to 3.0 from 2.x? Be sure to follow the [Upgrade](https://github.com/rawilk/filament-password-input/blob/main/upgrade.md) guide for breaking changes. You can install the package via composer: