From 8e98d67c569b88c6add471004c096ee4adc0540a Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Mon, 28 Sep 2026 22:51:52 +0300 Subject: [PATCH 1/6] Support externally controlled Swap state --- src/Components/Swap.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Components/Swap.php b/src/Components/Swap.php index 92caf7c..8bc167b 100644 --- a/src/Components/Swap.php +++ b/src/Components/Swap.php @@ -8,10 +8,13 @@ class Swap extends DaisyComponent { protected const VIEW = 'lazy::swap'; + public string $tag; + public function __construct( public bool $active = false, public bool $rotate = false, public bool $flip = false, + public bool $controlled = false, public string $name = '', public string $value = '1', public bool $checked = false, @@ -19,7 +22,9 @@ public function __construct( public mixed $onLabel = null, public mixed $offLabel = null, public mixed $indeterminateLabel = null, - ) {} + ) { + $this->tag = $this->controlled ? 'div' : 'label'; + } protected function viewClasses(): array { From dc830c82d0eb9ebaf6506f2b070a330377835338 Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Mon, 28 Sep 2026 22:51:55 +0300 Subject: [PATCH 2/6] Render controlled Swap without internal checkbox --- resources/views/swap.blade.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/resources/views/swap.blade.php b/resources/views/swap.blade.php index d7c0583..d4255dd 100644 --- a/resources/views/swap.blade.php +++ b/resources/views/swap.blade.php @@ -1,12 +1,14 @@ - + From db4a6c5fcdfecf6ed6228de788a20bc6e4ae9c4a Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Mon, 28 Sep 2026 22:51:58 +0300 Subject: [PATCH 3/6] Support rich Collapse summary and content classes --- src/Components/Collapse.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Components/Collapse.php b/src/Components/Collapse.php index 915d3d5..1970146 100644 --- a/src/Components/Collapse.php +++ b/src/Components/Collapse.php @@ -10,6 +10,8 @@ class Collapse extends DaisyComponent public function __construct( public string $title = '', + public string $summaryClass = '', + public string $contentClass = '', public bool $open = false, public bool $arrow = true, public bool $plus = false, @@ -18,8 +20,14 @@ public function __construct( protected function viewClasses(): array { return [ - 'title' => 'collapse-title', - 'content' => 'collapse-content', + 'title' => $this->classes([ + 'collapse-title', + $this->summaryClass => $this->summaryClass !== '', + ]), + 'content' => $this->classes([ + 'collapse-content', + $this->contentClass => $this->contentClass !== '', + ]), ]; } From 3c2cdd03335ea9b0528be309c07117ce867492c9 Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Mon, 28 Sep 2026 22:52:02 +0300 Subject: [PATCH 4/6] Render Collapse summary slot --- resources/views/collapse.blade.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/views/collapse.blade.php b/resources/views/collapse.blade.php index ea7d63e..f94b517 100644 --- a/resources/views/collapse.blade.php +++ b/resources/views/collapse.blade.php @@ -1,4 +1,10 @@
- {{ $title }} + + @isset($summary) + {{ $summary }} + @else + {{ $title }} + @endisset +
{{ $slot }}
From f1bf007da99600fa7e0eb73c1c134709cff1d5c7 Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Mon, 28 Sep 2026 22:52:25 +0300 Subject: [PATCH 5/6] Cover controlled Swap and rich Collapse APIs --- tests/Components/DaisyUiIntegrationTest.php | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/Components/DaisyUiIntegrationTest.php b/tests/Components/DaisyUiIntegrationTest.php index 6b90a12..626d42b 100644 --- a/tests/Components/DaisyUiIntegrationTest.php +++ b/tests/Components/DaisyUiIntegrationTest.php @@ -551,3 +551,27 @@ ->assertSee('Users') ->assertSee('42'); }); + + +it('supports externally controlled swap state for Alpine or other state owners', function () { + $this + ->blade('OnOff') + ->assertSee('assertSee('swap-rotate') + ->assertSee('x-bind:class', false) + ->assertSee('swap-on') + ->assertSee('swap-off') + ->assertDontSee('type="checkbox"', false); +}); + +it('supports rich collapse summaries and content classes', function () { + $this + ->blade('Permissions12 totalBody') + ->assertSee('collapse-arrow') + ->assertSee('text-lg') + ->assertSee('font-semibold') + ->assertSee('space-y-5') + ->assertSee('Permissions') + ->assertSee('12 total') + ->assertSee('Body'); +}); From e25bc32a193359e993a1a5cf99a752a06f4bc968 Mon Sep 17 00:00:00 2001 From: CrazyBoy49z <3448603+CrazyBoy49z@users.noreply.github.com> Date: Mon, 28 Sep 2026 19:52:47 +0000 Subject: [PATCH 6/6] Fix styling --- tests/Components/DaisyUiIntegrationTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Components/DaisyUiIntegrationTest.php b/tests/Components/DaisyUiIntegrationTest.php index 626d42b..434645c 100644 --- a/tests/Components/DaisyUiIntegrationTest.php +++ b/tests/Components/DaisyUiIntegrationTest.php @@ -552,7 +552,6 @@ ->assertSee('42'); }); - it('supports externally controlled swap state for Alpine or other state owners', function () { $this ->blade('OnOff')