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

56 lines
2.7 KiB
PHP
Raw Normal View History

2024-03-18 12:28:53 +01:00
<div @class([
'flex-1' => $isMultiline,
'w-full' => !$isMultiline,
])>
2023-05-25 14:05:44 +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-07-13 13:16:24 +02:00
@if ($required)
2023-08-22 17:44:49 +02:00
<x-highlighted text="*" />
2023-07-13 13:16:24 +02:00
@endif
@if ($helper)
2023-08-11 20:19:42 +02:00
<x-helper :helper="$helper" />
2023-07-13 13:16:24 +02:00
@endif
2023-05-05 09:28:00 +02:00
</label>
@endif
2023-08-08 14:46:23 +02:00
@if ($type === 'password')
2024-03-15 22:02:37 +01:00
<div class="relative" x-data="{ type: 'password' }">
2023-07-13 13:16:24 +02:00
@if ($allowToPeak)
<div x-on:click="changePasswordFieldType"
2024-03-24 16:00:25 +01:00
class="absolute inset-y-0 right-0 flex items-center pr-2 cursor-pointer hover:dark:text-white">
2023-07-13 13:16:24 +02:00
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" stroke-width="1.5"
2023-08-11 20:19:42 +02:00
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" />
2023-07-13 13:16:24 +02:00
</svg>
</div>
@endif
2024-03-22 11:34:15 +01:00
<input value="{{ $value }}" {{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
2024-03-18 12:28:53 +01:00
@if ($id !== 'null') wire:model={{ $id }} @endif
2024-03-22 11:34:15 +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" wire:loading.attr="disabled"
type="{{ $type }}" @readonly($readonly) @disabled($disabled) id="{{ $id }}"
name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"
2023-09-05 12:14:31 +02:00
aria-placeholder="{{ $attributes->get('placeholder') }}">
2023-07-13 13:16:24 +02:00
</div>
2023-08-08 14:46:23 +02:00
@else
2023-12-13 14:44:11 +01:00
<input @if ($value) value="{{ $value }}" @endif
{{ $attributes->merge(['class' => $defaultClass]) }} @required($required) @readonly($readonly)
2024-03-18 12:28:53 +01:00
@if ($id !== 'null') wire:model={{ $id }} @endif
2024-03-22 11:34:15 +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" wire:loading.attr="disabled"
type="{{ $type }}" @disabled($disabled)
2024-03-18 12:28:53 +01:00
@if ($id !== 'null') id={{ $id }} @endif name="{{ $name }}"
placeholder="{{ $attributes->get('placeholder') }}">
2023-07-13 13:16:24 +02:00
@endif
@if (!$label && $helper)
2023-08-11 20:19:42 +02:00
<x-helper :helper="$helper" />
2023-07-13 13:16:24 +02:00
@endif
@error($id)
2023-08-11 20:19:42 +02:00
<label class="label">
<span class="text-red-500 label-text-alt">{{ $message }}</span>
</label>
@enderror
2023-05-17 15:46:20 +02:00
</div>