Skip to content

Commit bb7f4cb

Browse files
authored
Merge pull request #54 from pxlrbt/feature/filament-v4
Filament v4 support
2 parents ddf57e3 + 193d7db commit bb7f4cb

File tree

12 files changed

+1156
-1015
lines changed

12 files changed

+1156
-1015
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"php": "^8.0",
21-
"filament/filament": "^3.0.0-stable",
21+
"filament/filament": "^3.0|^4.0",
2222
"wire-elements/spotlight": "^2.0"
2323
},
2424
"require-dev": {

package-lock.json

Lines changed: 1133 additions & 979 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
"private": true,
33
"scripts": {
44
"dev": "mix watch",
5-
"build": "mix --production && npm run purge",
6-
"purge": "filament-purge -i resources/dist/css/spotlight.css -o resources/dist/css/spotlight.css -v 3.x"
5+
"build": "mix --production"
76
},
87
"devDependencies": {
98
"autoprefixer": "^10.1.0",
109
"laravel-mix": "^6.0.6",
1110
"postcss": "^8.2.1",
12-
"tailwindcss": "^3.0.23",
13-
"@awcodes/filament-plugin-purge": "^1.0.1"
11+
"@tailwindcss/postcss": "^4.1.8",
12+
"tailwindcss": "^4"
1413
},
1514
"dependencies": {
1615
"fuse.js": "^6.5.3"

readme.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,26 @@ https://user-images.githubusercontent.com/22632550/159757479-ca9c3f46-7638-4889-
2929

3030

3131
| Plugin Version | Filament Version | PHP Version |
32-
|----------------|-----------------|-------------|
33-
| 0.x | 2.x | \> 8.0 |
34-
| 1.x | 3.x | \> 8.1 |
32+
|----------------|------------------|-------------|
33+
| 0.x | 2.x | \> 8.0 |
34+
| 1.x | 3.x | \> 8.1 |
35+
| 2.x | 4.x | \> 8.1 |
3536

3637

3738
```bash
3839
composer require pxlrbt/filament-spotlight
3940
```
4041

41-
### Assets
42+
### Upgrade guide for Filament v4
4243

43-
Publish the assets (Filament > 3)
44+
From v2 onwards you will need a [Custom Theme](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) to include the Tailwind classes for the Spotlight component. See note below.
4445

45-
```bash
46-
php artisan filament:assets
46+
### Styles
47+
48+
To include the Tailwind classes that are used in the Spotlight component, you need to create a [Custom Theme](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) and include the following line:
49+
50+
```css
51+
@source '../../../../vendor/wire-elements/**/*.blade.php';
4752
```
4853

4954
### Plugin registration

resources/css/spotlight.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

resources/dist/css/spotlight.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/dist/js/spotlight.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Actions/RegisterUserMenu.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22

33
namespace pxlrbt\FilamentSpotlight\Actions;
44

5+
use Filament\Actions\Action;
56
use Filament\Facades\Filament;
6-
use Filament\Navigation\MenuItem;
77
use Filament\Panel;
88
use LivewireUI\Spotlight\Spotlight;
99
use pxlrbt\FilamentSpotlight\Commands\PageCommand;
1010

1111
class RegisterUserMenu
1212
{
13-
public static function boot(Panel $panel)
13+
public static function boot(Panel $panel): void
1414
{
1515
$self = new static;
16-
/**
17-
* @var array<MenuItem> $items
18-
*/
16+
1917
$items = $panel->getUserMenuItems();
2018

2119
foreach ($items as $key => $item) {
@@ -35,7 +33,7 @@ public static function boot(Panel $panel)
3533
}
3634
}
3735

38-
protected function getName(string $key, MenuItem $item): ?string
36+
protected function getName(string $key, Action $item): ?string
3937
{
4038
return match ($key) {
4139
'account' => $item->getLabel() ?? __('filament-spotlight::spotlight.account'),
@@ -44,7 +42,7 @@ protected function getName(string $key, MenuItem $item): ?string
4442
};
4543
}
4644

47-
protected function getUrl(string $key, MenuItem $item): ?string
45+
protected function getUrl(string $key, Action $item): ?string
4846
{
4947
return match ($key) {
5048
'logout' => $item->getUrl() ?? Filament::getLogoutUrl(),

src/SpotlightPlugin.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function boot(Panel $panel): void
4848
}
4949

5050
});
51-
5251
}
5352

5453
public static function registerNavigation($panel)

src/SpotlightServiceProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace pxlrbt\FilamentSpotlight;
44

5-
use Filament\Support\Assets\Css;
65
use Filament\Support\Assets\Js;
76
use Filament\Support\Facades\FilamentAsset;
87
use Illuminate\Support\ServiceProvider;
@@ -16,7 +15,6 @@ public function boot()
1615
config()->set('livewire-ui-spotlight.commands', []);
1716

1817
FilamentAsset::register([
19-
Css::make('spotlight-css', __DIR__.'/../resources/dist/css/spotlight.css'),
2018
Js::make('spotlight-js', __DIR__.'/../resources/dist/js/spotlight.js'),
2119
], package: 'pxlrbt/filament-spotlight');
2220
}

0 commit comments

Comments
 (0)