An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat(ui): add split action button component
peaklabs-deve71648d01ba3
diff --git a/resources/css/app.css b/resources/css/app.cssindex 30ccf4ac02..09f3e18de8 100644--- a/resources/css/app.css+++ b/resources/css/app.css@@ -1870,6 +1870,72 @@ html[data-theme="custom"] textarea:disabled {flex-shrink: 0;}+.split-action {+ display: inline-flex;+ align-items: stretch;+}++.split-action-main,+.split-action-caret {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 0.375rem;+ height: 2rem;+ font-size: 13px;+ font-weight: 500;+ white-space: nowrap;+ cursor: pointer;+ border: none;+ background: linear-gradient(to bottom, var(--color-coollabs-100), var(--color-coollabs-200));+ color: #ffffff;+ transition: background-color 0.15s, color 0.15s, filter 0.15s;+}++.split-action-main {+ flex: 1 1 auto;+ min-width: 0;+ padding: 0 0.625rem;+ border-radius: 6px 0 0 6px;+}++.split-action-caret {+ flex-shrink: 0;+ width: 1.75rem;+ border-left: 1px solid rgba(255, 255, 255, 0.25);+ border-radius: 0 6px 6px 0;+}++.split-action > .split-action-main:only-of-type {+ border-radius: 6px;+}++.split-action-main:hover:not(:disabled),+.split-action-caret:hover:not(:disabled) {+ background: linear-gradient(to bottom, var(--color-coollabs-100), var(--color-coollabs));+ color: #ffffff;+}++.split-action-main:disabled,+.split-action-caret:disabled {+ cursor: not-allowed;+ opacity: 0.45;+}++.split-action-main:focus-visible,+.split-action-caret:focus-visible {+ outline: none;+ position: relative;+ z-index: 1;+ box-shadow: 0 0 0 1px var(--color-accent);+}++/* Compact height inside the fixed heading action bar */+.application-heading-actions .split-action-main,+.application-heading-actions .split-action-caret {+ height: 1.75rem;+}+/* Custom listbox (replaces native <select>) */.listbox-trigger {display: flex;diff --git a/resources/views/components/split-action.blade.php b/resources/views/components/split-action.blade.phpnew file mode 100644index 0000000000..c27525166c--- /dev/null+++ b/resources/views/components/split-action.blade.php@@ -0,0 +1,19 @@+<div {{ $attributes->class(['split-action relative']) }} x-data="{ open: false }"+ x-effect="$dispatch('resource-actions-toggled', { open })" @click.outside="open = false"+ @keydown.escape.window="open = false">+ <button type="button" {{ $main->attributes->class(['split-action-main']) }}>+ {{ $main }}+ </button>+ @if ($slot->hasActualContent())+ <button type="button" class="split-action-caret" @click="open = !open" :aria-expanded="open"+ aria-haspopup="menu" aria-label="More actions">+ <span class="inline-flex transition-transform" :class="open && 'rotate-180'">+ <x-reicon name="chevron-down" class="size-3" />+ </span>+ </button>+ <div x-cloak x-show="open" x-transition.origin.top+ class="listbox-panel right-0! xl:left-auto! xl:min-w-60! xl:max-w-96!" role="menu">+ {{ $slot }}+ </div>+ @endif+</div>diff --git a/tests/Feature/MutableLivewireComponentsAuthorizationTest.php b/tests/Feature/MutableLivewireComponentsAuthorizationTest.phpindex f6991025c8..c8644a2c1d 100644--- a/tests/Feature/MutableLivewireComponentsAuthorizationTest.php+++ b/tests/Feature/MutableLivewireComponentsAuthorizationTest.php@@ -43,7 +43,7 @@ it('hides resource action menus when the user cannot manage the resource', functforeach (['mobile', 'desktop'] as $viewport) {expect($source)->toMatch(- "/@can\\('{$ability}', \\$".$resource."\\)[\\s\\S]*?<div id=\"{$prefix}-{$viewport}-actions\"/"+ "/@can\\('{$ability}', \\$".$resource."\\)[\\s\\S]*?<x-split-action id=\"{$prefix}-{$viewport}-actions\"/");}})->with([diff --git a/tests/Feature/ResourceHeadingUnifiedNavbarTest.php b/tests/Feature/ResourceHeadingUnifiedNavbarTest.phpindex bb9e888982..eb9e1d4d6a 100644--- a/tests/Feature/ResourceHeadingUnifiedNavbarTest.php+++ b/tests/Feature/ResourceHeadingUnifiedNavbarTest.php@@ -163,14 +163,14 @@ it('keeps advanced operations in a dedicated Advanced dropdown', function () {expect(substr_count($application, 'resource-heading-navbar'))->toBe(1);});-it('groups desktop application lifecycle controls in one Actions dropdown', function () {+it('groups desktop application lifecycle controls in one split control', function () {$heading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php'));$desktop = str($heading)->after('resource-heading-actions flex')->toString();expect($desktop)->toContain('application-desktop-actions')- ->toContain('Actions')- ->toContain('listbox-panel top-full! right-0! left-auto!')+ ->toContain('<x-split-action')+ ->toContain('<x-slot:main')->toContain('listbox-option')->toContain('Deploy')->toContain('Restart')@@ -217,8 +217,8 @@ it('groups service restart options in the Actions dropdown', function () {$mobile = str($heading)->before("@teleport('#resource-action-hud-slot')")->toString();expect($mobile)- ->toContain('Restart current version')- ->toContain('Pull latest and restart')+ ->toContain('Restart')+ ->toContain('Restart (pull latest)')->not->toContain('Pull Latest Images & Restart');});@@ -232,21 +232,17 @@ it('orders service restart actions before stop and advanced operations', functio->toBeLessThan(strpos($actions, 'Stop'));});-it('groups application lifecycle options in an Actions dropdown', function () {+it('promotes the primary application action in the desktop split control', function () {$heading = file_get_contents(resource_path('views/livewire/project/application/heading.blade.php'));$desktop = str($heading)->after('resource-heading-actions flex')->toString();- $trigger = str($desktop)->after('id="application-desktop-actions"')->before('<div x-cloak')->toString();expect($desktop)->toContain('id="application-desktop-actions"')- ->toContain('Actions')+ ->toContain('<x-slot:main wire:click="deploy">')->toContain('Deploy')->toContain('Deploy (without cache)')->toContain('force_deploy_without_cache')- ->toContain('deploy(true)')- ->and($trigger)- ->toContain('button button-highlighted')- ->not->toContain('play-circle');+ ->toContain('deploy(true)');$mobile = str($heading)->before("@teleport('#resource-action-hud-slot')")->toString();@@ -277,18 +273,17 @@ it('uses the shared Coollabs gradient for primary resource actions in the deskto->toContain('@apply button-highlighted;');});-it('uses iconless highlighted Actions dropdowns for service and proxy lifecycle controls', function () {+it('promotes a primary action for service and proxy lifecycle controls', function () {foreach ([resource_path('views/livewire/project/service/heading.blade.php') => 'service-desktop-actions',resource_path('views/livewire/server/navbar.blade.php') => 'server-desktop-actions',] as $path => $id) {$heading = file_get_contents($path);- $trigger = str($heading)->after("id=\"{$id}\"")->before('<div x-cloak')->toString();+ $control = str($heading)->after("id=\"{$id}\"")->before('</x-split-action>')->toString();- expect($trigger)- ->toContain('button button-highlighted')- ->toContain('Actions')- ->not->toContain('play-circle');+ expect($control)+ ->toContain('<x-slot:main')+ ->toContain('listbox-option');}});@@ -305,10 +300,10 @@ it('keeps database lifecycle controls direct and highlights the primary action',$desktop = str($heading)->after('resource-heading-actions flex')->before('@endteleport')->toString();expect($desktop)+ ->toContain('<x-split-action')+ ->toContain('<x-slot:main')->toContain('Restart')->toContain('Stop')- ->toContain('button button-highlighted')- ->not->toContain('<x-reicon')->not->toContain('<x-resource-heading-overflow');});@@ -498,7 +493,7 @@ it('uses the same mobile heading gap on deployment pages as application settings$deploymentShow = file_get_contents(resource_path('views/livewire/project/application/deployment/show.blade.php'));expect($configuration)->toContain('application-settings-workspace mt-4')- ->and($deploymentIndex)->toContain("'mt-4 max-w-[1180px] lg:mt-0' => ! \$embedded")+ ->and($deploymentIndex)->toContain("'mt-4 max-w-none lg:mt-0' => ! \$embedded")->and($deploymentShow)->toContain('application-settings-workspace mt-4')->toContain('lg:mt-0');});@@ -536,9 +531,9 @@ it('fits the combined deployment history and logs within the desktop viewport',expect($indexClass)->toContain('$this->defaultTake = 3;')->and($showView)- ->toContain('xl:h-[calc(100dvh-7.5rem)]')- ->toContain('xl:overflow-hidden')- ->toContain('xl:flex-1');+ ->toContain('min-h-[calc(100dvh-7.5rem)]')+ ->toContain('xl:h-[32rem] xl:min-h-0 xl:flex-none')+ ->toContain('overflow-hidden');});it('uses only the healthcheck toggle action to communicate enabled state', function () {