forked from filamentphp/filament
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
4cb232f
commit d1b8eae
Showing
10 changed files
with
276 additions
and
63 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'heading' => 'Keine Daten vorhanden', | ||
|
||
]; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'heading' => 'Nothing to display', | ||
|
||
]; |
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
5 changes: 5 additions & 0 deletions
5
packages/widgets/resources/views/components/empty-state/description.blade.php
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<p | ||
{{ $attributes->class(['fi-wi-empty-state-description text-sm text-gray-500 dark:text-gray-400']) }} | ||
> | ||
{{ $slot }} | ||
</p> |
5 changes: 5 additions & 0 deletions
5
packages/widgets/resources/views/components/empty-state/heading.blade.php
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h4 | ||
{{ $attributes->class(['fi-wi-empty-state-heading text-base font-semibold leading-6 text-gray-950 dark:text-white']) }} | ||
> | ||
{{ $slot }} | ||
</h4> |
46 changes: 46 additions & 0 deletions
46
packages/widgets/resources/views/components/empty-state/index.blade.php
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@php | ||
use Filament\Support\Enums\Alignment; | ||
@endphp | ||
|
||
@props([ | ||
'actions' => [], | ||
'description' => null, | ||
'heading', | ||
'icon', | ||
]) | ||
|
||
<div | ||
{{ $attributes->class(['fi-wi-empty-state px-6 py-12']) }} | ||
> | ||
<div | ||
class="fi-wi-empty-state-content mx-auto grid max-w-lg justify-items-center text-center" | ||
> | ||
<div | ||
class="fi-wi-empty-state-icon-ctn mb-4 rounded-full bg-gray-100 p-3 dark:bg-gray-500/20" | ||
> | ||
<x-filament::icon | ||
:icon="$icon" | ||
class="fi-wi-empty-state-icon h-6 w-6 text-gray-500 dark:text-gray-400" | ||
/> | ||
</div> | ||
|
||
<x-filament-widgets::empty-state.heading> | ||
{{ $heading }} | ||
</x-filament-widgets::empty-state.heading> | ||
|
||
@if ($description) | ||
<x-filament-widgets::empty-state.description class="mt-1"> | ||
{{ $description }} | ||
</x-filament-widgets::empty-state.description> | ||
@endif | ||
|
||
@if ($actions) | ||
<x-filament::actions | ||
:actions="$actions" | ||
:alignment="Alignment::Center" | ||
wrap | ||
class="mt-6" | ||
/> | ||
@endif | ||
</div> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Filament\Widgets\Concerns; | ||
|
||
use Filament\Support\Concerns\EvaluatesClosures; | ||
use Filament\Support\Facades\FilamentIcon; | ||
use Filament\Actions\Action; | ||
use Filament\Actions\ActionGroup; | ||
use Illuminate\Contracts\Support\Htmlable; | ||
use Illuminate\Contracts\View\View; | ||
use Closure; | ||
|
||
trait HasEmptyState | ||
{ | ||
use EvaluatesClosures; | ||
|
||
protected View | Htmlable | Closure | null $emptyState = null; | ||
|
||
protected string | Htmlable | Closure | null $emptyStateDescription = null; | ||
|
||
protected string | Htmlable | Closure | null $emptyStateHeading = null; | ||
|
||
protected string | Closure | null $emptyStateIcon = null; | ||
|
||
protected bool $empty = false; | ||
|
||
public function getEmptyState(): View | Htmlable | null | ||
{ | ||
return $this->evaluate($this->emptyState); | ||
} | ||
|
||
/** | ||
* @return array<Action | ActionGroup> | ||
*/ | ||
public function getEmptyStateActions(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getEmptyStateDescription(): string | Htmlable | null | ||
{ | ||
return $this->evaluate($this->emptyStateDescription); | ||
} | ||
|
||
public function getEmptyStateHeading(): string | Htmlable | ||
{ | ||
return $this->evaluate($this->emptyStateHeading) ?? __('filament-panels::widgets/empty-state.heading'); | ||
} | ||
|
||
public function getEmptyStateIcon(): string | ||
{ | ||
return $this->evaluate($this->emptyStateIcon) | ||
?? FilamentIcon::resolve('panels::widgets.empty-state') | ||
?? 'heroicon-o-x-mark'; | ||
} | ||
|
||
public function empty(bool $empty = true): void | ||
{ | ||
$this->empty = $empty; | ||
} | ||
|
||
public function isEmpty(): bool | ||
{ | ||
return $this->empty; | ||
} | ||
} |