forked from wireui/wireui
/
input.blade.php
94 lines (87 loc) · 3.22 KB
/
input.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@php
$hasError = !$errorless && $name && $errors->has($name);
@endphp
<div class="@if($disabled) opacity-60 @endif">
@if ($label || $cornerHint)
<div class="flex {{ !$label && $cornerHint ? 'justify-end' : 'justify-between items-end' }} mb-1">
@if ($label)
<x-dynamic-component
:component="WireUi::component('label')"
:label="$label"
:has-error="$hasError"
:for="$id"
:required="$attributes->get('required')"
/>
@endif
@if ($cornerHint)
<x-dynamic-component
:component="WireUi::component('label')"
:label="$cornerHint"
:has-error="$hasError"
:for="$id"
/>
@endif
</div>
@endif
<div class="relative rounded-md @unless($shadowless) shadow-sm @endunless">
@if ($prefix || $icon)
<div class="absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none
{{ $hasError ? 'text-negative-500' : 'text-secondary-400' }}">
@if ($icon)
<x-dynamic-component
:component="WireUi::component('icon')"
:name="$icon"
class="w-5 h-5"
/>
@elseif($prefix)
<span class="flex items-center self-center pl-1">
{{ $prefix }}
</span>
@endif
</div>
@elseif($prepend)
{{ $prepend }}
@endif
<input {{ $attributes->class([
$getInputClasses($hasError),
])->merge([
'type' => 'text',
'autocomplete' => 'off',
]) }} />
@if ($suffix || $rightIcon || ($hasError && !$append))
<div class="absolute inset-y-0 right-0 pr-2.5 flex items-center pointer-events-none
{{ $hasError ? 'text-negative-500' : 'text-secondary-400' }}">
@if ($rightIcon)
<x-dynamic-component
:component="WireUi::component('icon')"
:name="$rightIcon"
class="w-5 h-5"
/>
@elseif ($suffix)
<span class="flex items-center justify-center pr-1">
{{ $suffix }}
</span>
@elseif ($hasError)
<x-dynamic-component
:component="WireUi::component('icon')"
name="exclamation-circle"
class="w-5 h-5"
/>
@endif
</div>
@elseif ($append)
{{ $append }}
@endif
</div>
@if (!$hasError && $hint)
<label @if ($id) for="{{ $id }}" @endif class="mt-2 text-sm text-secondary-500 dark:text-secondary-400">
{{ $hint }}
</label>
@endif
@if ($name && !$errorless)
<x-dynamic-component
:component="WireUi::component('error')"
:name="$name"
/>
@endif
</div>