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 @@ class Input extends Component
public bool $readonly = false, public bool $readonly = false,
public string|null $helper = null, public string|null $helper = null,
public bool $allowToPeak = true, 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 @@ class Textarea extends Component
public bool $disabled = false, public bool $disabled = false,
public bool $readonly = false, public bool $readonly = false,
public string|null $helper = null, 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 @endif
</label> </label>
@endif @endif
@if ($type !== 'password') @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')
<div class="relative" x-data> <div class="relative" x-data>
@if ($allowToPeak) @if ($allowToPeak)
<div x-on:click="changePasswordFieldType" <div x-on:click="changePasswordFieldType"
@ -29,11 +24,18 @@
@endif @endif
<input {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required) <input {{ $attributes->merge(['class' => $defaultClass . ' pl-10']) }} @required($required)
wire:model.defer={{ $id }} wire:dirty.class.remove='text-white' wire:model.defer={{ $id }} wire:dirty.class.remove='text-white'
wire:dirty.class="text-black bg-warning" wire:loading.attr="disabled" type="{{ $type }}" wire:dirty.class="input-warning" wire:loading.attr="disabled" type="{{ $type }}"
@disabled($readonly) @disabled($disabled) id="{{ $id }}" @readonly($readonly)
@disabled($disabled) id="{{ $id }}"
name="{{ $name }}"> name="{{ $name }}">
</div> </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 @endif
@if (!$label && $helper) @if (!$label && $helper)
<x-helper :helper="$helper"/> <x-helper :helper="$helper"/>

View File

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

View File

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