coolify/resources/views/components/forms/textarea.blade.php

81 lines
4.0 KiB
PHP
Raw Normal View History

2024-04-12 13:33:56 +02:00
<script>
function handleKeydown(e) {
if (e.keyCode === 9) {
e.preventDefault();
e.target.setRangeText(
2024-04-12 15:23:48 +02:00
' ',
2024-04-12 13:33:56 +02:00
e.target.selectionStart,
e.target.selectionStart,
'end'
);
}
}
</script>
2024-03-15 22:02:37 +01:00
<div class="flex-1 form-control">
2023-06-02 15:15:12 +02:00
@if ($label)
2024-04-03 15:10:21 +02:00
<label class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }}
2023-09-19 15:51:13 +02:00
@if ($required)
<x-highlighted text="*" />
@endif
@if ($helper)
<x-helper :helper="$helper" />
@endif
2023-05-17 15:46:20 +02:00
</label>
@endif
2024-06-24 11:21:39 +02:00
@if ($useMonacoEditor)
<x-forms.monaco-editor id="{{ $id }}" language="{{ $monacoEditorLanguage }}" name="{{ $name }}"
name="{{ $id }}" model="{{ $value ?? $id }}" wire:model="{{ $value ?? $id }}"
readonly="{{ $readonly }}" label="dockerfile" />
@else
2024-06-24 11:21:39 +02:00
@if ($type === 'password')
<div class="relative" x-data="{ type: 'password' }">
@if ($allowToPeak)
<div x-on:click="changePasswordFieldType"
class="absolute inset-y-0 right-0 flex items-center h-6 pt-2 pr-2 cursor-pointer hover:dark:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path
d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
</svg>
</div>
@endif
<input x-cloak x-show="type === 'password'" value="{{ $value }}"
{{ $attributes->merge(['class' => $defaultClassInput]) }} @required($required)
@if ($id !== 'null') wire:model={{ $id }} @endif
wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300'
wire:dirty.class="dark:focus:ring-warning dark:ring-warning" wire:loading.attr="disabled"
type="{{ $type }}" @readonly($readonly) @disabled($disabled) id="{{ $id }}"
name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"
aria-placeholder="{{ $attributes->get('placeholder') }}">
<textarea x-cloak x-show="type !== 'password'" placeholder="{{ $placeholder }}"
{{ $attributes->merge(['class' => $defaultClass]) }}
@if ($realtimeValidation) wire:model.debounce.200ms="{{ $id }}"
2024-03-15 22:02:37 +01:00
@else
wire:model={{ $value ?? $id }}
2024-03-20 12:54:06 +01:00
wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300' wire:dirty.class="dark:focus:ring-warning dark:ring-warning" @endif
2024-06-24 11:21:39 +02:00
@disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}"
name="{{ $name }}" name={{ $id }}></textarea>
2024-03-15 22:02:37 +01:00
2024-06-24 11:21:39 +02:00
</div>
@else
<textarea {{ $allowTab ? '@keydown.tab=handleKeydown' : '' }} placeholder="{{ $placeholder }}"
{{ !$spellcheck ? 'spellcheck=false' : '' }} {{ $attributes->merge(['class' => $defaultClass]) }}
@if ($realtimeValidation) wire:model.debounce.200ms="{{ $id }}"
2023-09-15 11:55:58 +02:00
@else
2024-03-15 22:02:37 +01:00
wire:model={{ $value ?? $id }}
2024-03-20 12:54:06 +01:00
wire:dirty.class.remove='dark:focus:ring-coolgray-300 dark:ring-coolgray-300' wire:dirty.class="dark:focus:ring-warning dark:ring-warning" @endif
2024-06-24 11:21:39 +02:00
@disabled($disabled) @readonly($readonly) @required($required) id="{{ $id }}"
name="{{ $name }}" name={{ $id }}></textarea>
@endif
@endif
2023-05-17 15:46:20 +02:00
@error($id)
2023-08-11 20:19:42 +02:00
<label class="label">
<span class="text-red-500 label-text-alt">{{ $message }}</span>
</label>
2023-05-17 15:46:20 +02:00
@enderror
</div>