fix: input and textarea

This commit is contained in:
Andras Bacsai 2023-08-08 14:46:23 +02:00
parent bd9a1dbaf3
commit b4b1c671bd
5 changed files with 15 additions and 13 deletions

View File

@ -20,7 +20,7 @@ public function __construct(
public bool $readonly = false,
public string|null $helper = null,
public bool $allowToPeak = true,
public string $defaultClass = "input input-sm bg-coolgray-200 rounded text-white w-full disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500"
public string $defaultClass = "input input-sm bg-coolgray-200 rounded text-white w-full disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500 read-only:text-neutral-500 read-only:bg-coolgray-200/50"
)
{
}

View File

@ -24,7 +24,7 @@ public function __construct(
public bool $disabled = false,
public bool $readonly = false,
public string|null $helper = null,
public string $defaultClass = "textarea bg-coolgray-200 rounded text-white scrollbar disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500"
public string $defaultClass = "textarea bg-coolgray-200 rounded text-white scrollbar disabled:bg-coolgray-200/50 disabled:border-none placeholder:text-coolgray-500 read-only:text-neutral-500 read-only:bg-coolgray-200/50"
)
{
//

View File

@ -9,12 +9,7 @@
@endif
</label>
@endif
@if ($type !== 'password')
<input {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
@disabled($readonly) @disabled($disabled) id="{{ $id }}" name="{{ $name }}">
@elseif ($type === 'password')
@if ($type === 'password')
<div class="relative" x-data>
@if ($allowToPeak)
<div x-on:click="changePasswordFieldType"
@ -29,11 +24,18 @@ class="absolute inset-y-0 left-0 flex items-center pl-2 cursor-pointer hover:tex
@endif
<input {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required)
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}"
@disabled($readonly) @disabled($disabled) id="{{ $id }}"
wire:dirty.class="input-warning" wire:loading.attr="disabled" type="{{ $type }}"
@readonly($readonly)
@disabled($disabled) id="{{ $id }}"
name="{{ $name }}">
</div>
@else
<input
{{ $attributes->merge(['class' => $defaultClass]) }} @required($required) @readonly($readonly)
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
wire:dirty.class="input-warning" wire:loading.attr="disabled" type="{{ $type }}"
@disabled($disabled) id="{{ $id }}" name="{{ $name }}">
@endif
@if (!$label && $helper)
<x-helper :helper="$helper"/>

View File

@ -30,8 +30,8 @@ class="w-4 h-4 stroke-current">
</label>
@endif
<textarea placeholder="{{$placeholder}}"
{{ $attributes->merge(['class' => $defaultClass]) }} @required($required) wire:model.defer={{ $id }}
@disabled($disabled) id="{{ $id }}" name="{{ $name }}" name={{ $id }}
{{ $attributes->merge(['class' => $defaultClass]) }} wire:model.defer={{ $id }}
@disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}" name="{{ $name }}" name={{ $id }}
wire:model.defer={{ $value ?? $id }} wire:dirty.class="input-warning"></textarea>
@error($id)
<label class="label">

View File

@ -9,7 +9,7 @@
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
<livewire:project.shared.storages.add/>
</div>
<div class="">Persistent storage to preserve data between deployments.</div>
<div>Persistent storage to preserve data between deployments.</div>
</div>
<div class="flex flex-col gap-2 py-4">
@forelse ($resource->persistentStorages as $storage)