Car-Repairs-Shop/resources/views/flux/textarea.blade.php
sackey e839d40a99
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Initial commit
2025-07-30 17:15:50 +00:00

39 lines
1.3 KiB
PHP

@props([
'name' => $attributes->whereStartsWith('wire:model')->first(),
'resize' => 'vertical',
'invalid' => null,
'rows' => 4,
])
@php
$invalid ??= ($name && $errors->has($name));
$classes = Flux::classes()
->add('block p-3 w-full')
->add('shadow-xs disabled:shadow-none border rounded-lg')
->add('bg-white dark:bg-white/10 dark:disabled:bg-white/[7%]')
->add($resize ? 'resize-y' : 'resize-none')
->add('text-base sm:text-sm text-zinc-700 disabled:text-zinc-500 placeholder-zinc-400 disabled:placeholder-zinc-400/70 dark:text-zinc-300 dark:disabled:text-zinc-400 dark:placeholder-zinc-400 dark:disabled:placeholder-zinc-500')
->add($invalid ? 'border-red-500' : 'border-zinc-200 border-b-zinc-300/80 dark:border-white/10')
;
$resizeStyle = match ($resize) {
'none' => 'resize: none',
'both' => 'resize: both',
'horizontal' => 'resize: horizontal',
'vertical' => 'resize: vertical',
};
@endphp
<flux:with-field :$attributes>
<textarea
{{ $attributes->class($classes) }}
rows="{{ $rows }}"
style="{{ $resizeStyle }}; {{ $rows === 'auto' ? 'field-sizing: content' : '' }}"
@isset ($name) name="{{ $name }}" @endisset
@if ($invalid) aria-invalid="true" data-invalid @endif
data-flux-control
data-flux-textarea
>{{ $slot }}</textarea>
</flux:with-field>