Skip to content

Commit

Permalink
Livewire v3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PhiloNL committed Aug 25, 2023
1 parent 0bfae0f commit 05b4103
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Add the Livewire directive `@livewire('livewire-ui-spotlight')`:
</html>
```

## Alpine
## Alpine (only when using Livewire v2)

Spotlight requires [Alpine](https://github.com/alpinejs/alpine). You can use the official CDN to quickly include Alpine:

Expand All @@ -59,10 +59,14 @@ To open the Spotlight input bar you can use one of the following shortcuts:

You can customize the keybindings in the configuration file (see below). It's also possible to toggle Spotlight from any other Livewire component or via Javascript.

In any Livewire component you can use the `dispatchBrowserEvent` helper.
In any Livewire component you can use the `dispatchBrowserEvent` or `dispatch` helper.

```php
// Livewire v2
$this->dispatchBrowserEvent('toggle-spotlight');

// Livewire v3
$this->dispatch('toggle-spotlight');
```

You can also use the `$dispatch` helper from Alpine to trigger the same browser event from your markup.
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"laravel",
"spotlight"
],
"homepage": "https://github.com/livewire-ui/spotlight",
"homepage": "https://github.com/wire-elements/spotlight",
"license": "MIT",
"authors": [
{
"name": "Philo Hermans",
"email": "[email protected]",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"livewire/livewire": "^2.4",
"livewire/livewire": "^3.0",
"spatie/laravel-package-tools": "^1.4.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/spotlight.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@endisset

<div x-data="LivewireUISpotlight({
componentId: '{{ $this->id }}',
componentId: '{{ $this->id() }}',
placeholder: '{{ trans('livewire-ui-spotlight::spotlight.placeholder') }}',
commands: @js($commands),
showResultsWithoutInput: '{{ config('livewire-ui-spotlight.show_results_without_input') }}',
Expand Down

0 comments on commit 05b4103

Please sign in to comment.