2024-03-18 11:28:53 +00:00
|
|
|
<div @class([
|
|
|
|
|
'flex-1' => $isMultiline,
|
|
|
|
|
'w-full' => !$isMultiline,
|
|
|
|
|
])>
|
2023-05-25 12:05:44 +00:00
|
|
|
@if ($label)
|
2026-08-03 21:11:54 +00:00
|
|
|
{{--
|
|
|
|
|
Fixed-height label row (h-4 = helper icon). Helper lives outside <label> so
|
|
|
|
|
side-by-side fields align whether a field has a helper, required mark, both, or neither.
|
|
|
|
|
Margin is only on this wrapper — mb-0! beats .application-settings-form label rules.
|
|
|
|
|
--}}
|
|
|
|
|
<div class="mb-1.5 flex h-4 w-full items-center gap-1.5">
|
|
|
|
|
<label class="mb-0! flex items-center gap-1 text-sm font-medium leading-4">{{ $label }}
|
|
|
|
|
@if ($required)
|
|
|
|
|
<x-highlighted text="*" />
|
|
|
|
|
@endif
|
|
|
|
|
@isset($labelSuffix)
|
|
|
|
|
{{ $labelSuffix }}
|
|
|
|
|
@endisset
|
|
|
|
|
</label>
|
2023-07-13 11:16:24 +00:00
|
|
|
@if ($helper)
|
2023-08-11 18:19:42 +00:00
|
|
|
<x-helper :helper="$helper" />
|
2023-07-13 11:16:24 +00:00
|
|
|
@endif
|
2026-08-03 21:11:54 +00:00
|
|
|
</div>
|
2023-05-05 07:28:00 +00:00
|
|
|
@endif
|
2026-08-25 18:51:59 +00:00
|
|
|
@if ($loading)
|
|
|
|
|
<div class="{{ $defaultClass }} flex w-full items-center text-neutral-500 dark:text-fg-dim" aria-busy="true">
|
|
|
|
|
<x-loading :text="$loadingText" />
|
|
|
|
|
</div>
|
|
|
|
|
@elseif ($type === 'password')
|
2026-03-29 18:47:36 +00:00
|
|
|
<div class="relative" x-data="{ type: 'password' }" @success.window="type = 'password'">
|
2023-07-13 11:16:24 +00:00
|
|
|
@if ($allowToPeak)
|
2026-03-29 18:47:36 +00:00
|
|
|
<button type="button" x-on:click="type = type === 'password' ? 'text' : 'password'"
|
2026-08-03 21:11:54 +00:00
|
|
|
class="password-toggle flex absolute inset-y-0 right-0 z-10 items-center pr-2 cursor-pointer text-neutral-500 hover:text-black dark:text-neutral-400 dark:hover:text-white"
|
2026-03-29 18:47:36 +00:00
|
|
|
aria-label="Toggle password visibility">
|
2026-01-04 17:52:07 +00:00
|
|
|
{{-- Eye icon (shown when password is hidden) --}}
|
2026-08-03 21:11:54 +00:00
|
|
|
<x-reicon name="eye" x-show="type === 'password'" class="size-[18px]" />
|
|
|
|
|
{{-- Eye-off2 icon (shown when password is visible) --}}
|
|
|
|
|
<x-reicon name="eye-off2" x-cloak x-show="type === 'text'" class="size-[18px]" />
|
2026-03-29 18:47:36 +00:00
|
|
|
</button>
|
2023-07-13 11:16:24 +00:00
|
|
|
@endif
|
2026-06-20 00:23:24 +00:00
|
|
|
<input autocomplete="{{ $autocomplete }}" value="{{ $value }}"
|
|
|
|
|
x-bind:type="type"
|
|
|
|
|
x-bind:class="{ 'truncate': type === 'text' && ! $el.disabled }"
|
|
|
|
|
{{ $attributes->merge(['class' => $defaultClass]) }} @required($required)
|
|
|
|
|
@if ($modelBinding !== 'null') wire:model={{ $modelBinding }} wire:dirty.class="[box-shadow:inset_4px_0_0_#d52b1f,inset_0_0_0_2px_#e5e5e5] dark:[box-shadow:inset_4px_0_0_#fde047,inset_0_0_0_2px_#272322]" @endif
|
|
|
|
|
wire:loading.attr="disabled"
|
|
|
|
|
@readonly($readonly) @disabled($disabled) id="{{ $htmlId }}"
|
|
|
|
|
name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"
|
|
|
|
|
aria-placeholder="{{ $attributes->get('placeholder') }}"
|
|
|
|
|
@if ($autofocus) x-ref="autofocusInput" @endif>
|
2023-07-27 19:26:15 +00:00
|
|
|
|
2023-07-13 11:16:24 +00:00
|
|
|
</div>
|
2023-08-08 12:46:23 +00:00
|
|
|
@else
|
2024-09-27 14:32:03 +00:00
|
|
|
<input autocomplete="{{ $autocomplete }}" @if ($value) value="{{ $value }}" @endif
|
2023-12-13 13:44:11 +00:00
|
|
|
{{ $attributes->merge(['class' => $defaultClass]) }} @required($required) @readonly($readonly)
|
2026-06-20 00:23:24 +00:00
|
|
|
@if ($modelBinding !== 'null') wire:model={{ $modelBinding }} wire:dirty.class="[box-shadow:inset_4px_0_0_#d52b1f,inset_0_0_0_2px_#e5e5e5] dark:[box-shadow:inset_4px_0_0_#fde047,inset_0_0_0_2px_#272322]" @endif
|
2025-10-16 09:09:39 +00:00
|
|
|
wire:loading.attr="disabled"
|
2024-11-03 20:27:02 +00:00
|
|
|
type="{{ $type }}" @disabled($disabled) min="{{ $attributes->get('min') }}"
|
|
|
|
|
max="{{ $attributes->get('max') }}" minlength="{{ $attributes->get('minlength') }}"
|
|
|
|
|
maxlength="{{ $attributes->get('maxlength') }}"
|
2025-10-14 08:27:41 +00:00
|
|
|
@if ($htmlId !== 'null') id={{ $htmlId }} @endif name="{{ $name }}"
|
2025-08-18 12:54:08 +00:00
|
|
|
placeholder="{{ $attributes->get('placeholder') }}"
|
|
|
|
|
@if ($autofocus) x-ref="autofocusInput" @endif>
|
2023-07-13 11:16:24 +00:00
|
|
|
@endif
|
|
|
|
|
@if (!$label && $helper)
|
2023-08-11 18:19:42 +00:00
|
|
|
<x-helper :helper="$helper" />
|
2023-07-13 11:16:24 +00:00
|
|
|
@endif
|
2025-10-14 08:27:41 +00:00
|
|
|
@error($modelBinding)
|
2023-08-11 18:19:42 +00:00
|
|
|
<label class="label">
|
2026-08-14 11:34:00 +00:00
|
|
|
@php
|
|
|
|
|
preg_match('/(https?:\/\/\S+)$/', $message, $validationLinkMatches);
|
|
|
|
|
$validationLink = $validationLinkMatches[1] ?? null;
|
|
|
|
|
@endphp
|
|
|
|
|
<span class="text-red-500 label-text-alt">
|
|
|
|
|
@if ($validationLink)
|
|
|
|
|
{{ str($message)->beforeLast($validationLink)->trim() }}
|
|
|
|
|
<a class="font-medium underline" href="{{ $validationLink }}">Set them here.</a>
|
|
|
|
|
@else
|
|
|
|
|
{{ $message }}
|
|
|
|
|
@endif
|
|
|
|
|
</span>
|
2023-08-11 18:19:42 +00:00
|
|
|
</label>
|
2023-07-27 19:26:15 +00:00
|
|
|
@enderror
|
2023-05-17 13:46:20 +00:00
|
|
|
</div>
|