From 3961077b900baea6d3aa4616ce88fd5c9f1b1cd2 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:37:42 +0200 Subject: [PATCH] feat(forms): make textarea monospace opt-in and improve multiline toggle Add `monospace` prop to Textarea component so font-mono is no longer applied by default. Apply it explicitly to env variable editors, private key fields, and shared variable forms where monospace is appropriate. Use Alpine.js x-data/x-model to make the multiline toggle reactive without a full Livewire round-trip. Add wire:key on the input/textarea wrappers to force proper DOM replacement when switching modes. --- app/View/Components/Forms/Textarea.php | 7 +++- resources/css/app.css | 1 + .../shared/environment-variable/add.blade.php | 34 +++++++++++-------- .../shared/environment-variable/all.blade.php | 10 +++--- .../environment-variable/show.blade.php | 24 +++++++------ .../security/private-key/create.blade.php | 2 +- .../security/private-key/show.blade.php | 2 +- .../environment/show.blade.php | 2 +- .../shared-variables/project/show.blade.php | 2 +- .../shared-variables/team/index.blade.php | 2 +- ...ronmentVariableMultilineToggleViewTest.php | 22 ++++++++++++ .../PasswordVisibilityComponentTest.php | 14 ++++++++ 12 files changed, 87 insertions(+), 35 deletions(-) create mode 100644 tests/Feature/EnvironmentVariableMultilineToggleViewTest.php diff --git a/app/View/Components/Forms/Textarea.php b/app/View/Components/Forms/Textarea.php index a5303b947..02a23a26a 100644 --- a/app/View/Components/Forms/Textarea.php +++ b/app/View/Components/Forms/Textarea.php @@ -32,10 +32,11 @@ public function __construct( public bool $allowTab = false, public bool $spellcheck = false, public bool $autofocus = false, + public bool $monospace = false, public ?string $helper = null, public bool $realtimeValidation = false, public bool $allowToPeak = true, - public string $defaultClass = 'input scrollbar font-mono', + public string $defaultClass = 'input scrollbar', public string $defaultClassInput = 'input', public ?int $minlength = null, public ?int $maxlength = null, @@ -81,6 +82,10 @@ public function render(): View|Closure|string $this->name = $this->modelBinding !== 'null' ? $this->modelBinding : (string) $this->id; } + if ($this->monospace) { + $this->defaultClass .= ' font-mono'; + } + // $this->label = Str::title($this->label); return view('components.forms.textarea'); } diff --git a/resources/css/app.css b/resources/css/app.css index 2c30baf64..936e0c713 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -15,6 +15,7 @@ @theme { --font-sans: 'Geist Sans', Inter, sans-serif; + --font-mono: 'Geist Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; --font-geist-sans: 'Geist Sans', Inter, sans-serif; --font-logs: 'Geist Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; diff --git a/resources/views/livewire/project/shared/environment-variable/add.blade.php b/resources/views/livewire/project/shared/environment-variable/add.blade.php index 3d757ee63..4ce8c1b0e 100644 --- a/resources/views/livewire/project/shared/environment-variable/add.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/add.blade.php @@ -1,17 +1,23 @@ -
+ - @if ($is_multiline) - - @else - - @endif + + - @if (!$shared && !$is_multiline) -
+ @if (!$shared) +
Tip: Type {{ to reference a shared environment variable
@@ -34,8 +40,8 @@ label="Is Literal?" /> @endif - + Save - \ No newline at end of file + diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.php index a962b2cec..28c67c5b4 100644 --- a/resources/views/livewire/project/shared/environment-variable/all.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php @@ -84,24 +84,24 @@ Inline comments with space before # (e.g., KEY=value #comment) are stripped. - @if ($showPreview) - @endif Save All Environment Variables @else - @if ($showPreview) - @endif @endcan @endif -
\ No newline at end of file + diff --git a/resources/views/livewire/project/shared/environment-variable/show.blade.php b/resources/views/livewire/project/shared/environment-variable/show.blade.php index 059595221..6e93d296b 100644 --- a/resources/views/livewire/project/shared/environment-variable/show.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php @@ -150,17 +150,21 @@
@if ($is_multiline) - +
+ +
@else - +
+ +
@endif @if ($is_shared) -
\ No newline at end of file + diff --git a/resources/views/livewire/security/private-key/create.blade.php b/resources/views/livewire/security/private-key/create.blade.php index 4294823e0..fb0306265 100644 --- a/resources/views/livewire/security/private-key/create.blade.php +++ b/resources/views/livewire/security/private-key/create.blade.php @@ -13,7 +13,7 @@ - ACTION REQUIRED: Copy the 'Public Key' to your server's diff --git a/resources/views/livewire/security/private-key/show.blade.php b/resources/views/livewire/security/private-key/show.blade.php index 7d90b5005..a8bd17d4a 100644 --- a/resources/views/livewire/security/private-key/show.blade.php +++ b/resources/views/livewire/security/private-key/show.blade.php @@ -56,7 +56,7 @@ required disabled />
- +
diff --git a/resources/views/livewire/shared-variables/environment/show.blade.php b/resources/views/livewire/shared-variables/environment/show.blade.php index fde2d0ae8..0822fff10 100644 --- a/resources/views/livewire/shared-variables/environment/show.blade.php +++ b/resources/views/livewire/shared-variables/environment/show.blade.php @@ -26,7 +26,7 @@ class="dark:text-warning text-coollabs">@{{ environment.VARIABLENAME }}
@else
- Save All Environment Variables
diff --git a/resources/views/livewire/shared-variables/project/show.blade.php b/resources/views/livewire/shared-variables/project/show.blade.php index f89ad9ce7..2d839d26d 100644 --- a/resources/views/livewire/shared-variables/project/show.blade.php +++ b/resources/views/livewire/shared-variables/project/show.blade.php @@ -28,7 +28,7 @@ @else
- Save All Environment Variables
diff --git a/resources/views/livewire/shared-variables/team/index.blade.php b/resources/views/livewire/shared-variables/team/index.blade.php index fcfca35fb..04d2a5713 100644 --- a/resources/views/livewire/shared-variables/team/index.blade.php +++ b/resources/views/livewire/shared-variables/team/index.blade.php @@ -27,7 +27,7 @@ class="dark:text-warning text-coollabs">@{{ team.VARIABLENAME }} @else
- Save All Environment Variables
diff --git a/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php b/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php new file mode 100644 index 000000000..636e5eb66 --- /dev/null +++ b/tests/Feature/EnvironmentVariableMultilineToggleViewTest.php @@ -0,0 +1,22 @@ +toContain('x-data="{ isMultiline: $wire.entangle(\'is_multiline\') }"') + ->toContain('