Skip to content

Commit

Permalink
Merge pull request #15522 from filamentphp/container-queries
Browse files Browse the repository at this point in the history
Container queries
  • Loading branch information
danharrin authored Feb 5, 2025
2 parents c94b5e8 + 9160371 commit 6d35dd6
Show file tree
Hide file tree
Showing 17 changed files with 570 additions and 88 deletions.
2 changes: 1 addition & 1 deletion docs-assets/app/public/css/filament/support/support.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs-assets/app/public/js/filament/support/support.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/actions/resources/views/action-modal.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
:sticky-header="$actionIsModalHeaderSticky"
:width="$actionModalWidth"
:wire:key="$actionModalWireKey"
x-on:modal-closed.stop="$wire.unmountAction(false)"
:x-on:modal-closed="'if ($event.detail.id === ' . \Illuminate\Support\Js::from($actionModalId) . ') $wire.unmountAction(false)'"
>
{{ $action->getModalContent() }}

Expand Down
11 changes: 1 addition & 10 deletions packages/actions/resources/views/components/modals.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,17 @@
openModal: function () {
const id = this.generateModalId(this.actionNestingIndex)
if (! this.$el.querySelector(`#${id}`)) {
return
}
this.$dispatch('open-modal', { id })
},
closeModal: function () {
const id = this.generateModalId(this.actionNestingIndex)
if (! this.$el.querySelector(`#${id}`)) {
return
}
this.$dispatch('close-modal-quietly', { id })
},
}"
x-on:sync-action-modals.window="
if ($event.detail.id === '{{ $this->getId() }}')
syncActionModals($event.detail.newActionNestingIndex)
if ($event.detail.id === @js($this->getId())) syncActionModals($event.detail.newActionNestingIndex)
"
style="height: 0"
>
Expand Down
11 changes: 11 additions & 0 deletions packages/schemas/resources/views/schema.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ function (Component | Action | ActionGroup $component) use (&$hasVisibleComponen
@endphp

@if ((! $isDirectlyHidden()) && $hasVisibleComponents)
@if ($isRoot)
{!! '<div class="fi-grid-ctn">' !!}
@endif

<div
{{
$getExtraAttributeBag()
Expand Down Expand Up @@ -149,6 +153,9 @@ function (Component | Action | ActionGroup $component) use (&$hasVisibleComponen
x-show="{{ $xShow }}"
x-cloak
@endif
@class([
'fi-grid-ctn' => $schemaComponent->isGridContainer(),
])
>
{{ $schemaComponent }}
</div>
Expand All @@ -159,4 +166,8 @@ function (Component | Action | ActionGroup $component) use (&$hasVisibleComponen
@endif
@endforeach
</div>

@if ($isRoot)
{!! '</div>' !!}
@endif
@endif
2 changes: 2 additions & 0 deletions packages/schemas/src/Components/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Filament\Schemas\Components\Concerns\BelongsToModel;
use Filament\Schemas\Components\Concerns\CanBeConcealed;
use Filament\Schemas\Components\Concerns\CanBeDisabled;
use Filament\Schemas\Components\Concerns\CanBeGridContainer;
use Filament\Schemas\Components\Concerns\CanBeHidden;
use Filament\Schemas\Components\Concerns\CanBeLiberatedFromContainerGrid;
use Filament\Schemas\Components\Concerns\CanBeRepeated;
Expand Down Expand Up @@ -41,6 +42,7 @@ class Component extends ViewComponent
use BelongsToModel;
use CanBeConcealed;
use CanBeDisabled;
use CanBeGridContainer;
use CanBeHidden;
use CanBeLiberatedFromContainerGrid;
use CanBeRepeated;
Expand Down
22 changes: 22 additions & 0 deletions packages/schemas/src/Components/Concerns/CanBeGridContainer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Filament\Schemas\Components\Concerns;

use Closure;

trait CanBeGridContainer
{
protected bool | Closure $isGridContainer = false;

public function gridContainer(bool | Closure $condition = true): static
{
$this->isGridContainer = $condition;

return $this;
}

public function isGridContainer(): bool
{
return (bool) $this->evaluate($this->isGridContainer);
}
}
2 changes: 1 addition & 1 deletion packages/support/dist/index.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/support/dist/index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6d35dd6

Please sign in to comment.