@props([
'alpineDisabled' => null,
'alpineValid' => null,
'disabled' => false,
'inlinePrefix' => false,
'inlineSuffix' => false,
'prefix' => null,
'prefixActions' => [],
'prefixIcon' => null,
'prefixIconColor' => 'gray',
'prefixIconAlias' => null,
'suffix' => null,
'suffixActions' => [],
'suffixIcon' => null,
'suffixIconColor' => 'gray',
'suffixIconAlias' => null,
'valid' => true,
])
@php
use Filament\Support\View\Components\InputComponent\WrapperComponent\IconComponent;
use Illuminate\View\ComponentAttributeBag;
$prefixActions = array_filter(
$prefixActions,
fn (\Filament\Actions\Action $prefixAction): bool => $prefixAction->isVisible(),
);
$suffixActions = array_filter(
$suffixActions,
fn (\Filament\Actions\Action $suffixAction): bool => $suffixAction->isVisible(),
);
$hasPrefix = count($prefixActions) || $prefixIcon || filled($prefix);
$hasSuffix = count($suffixActions) || $suffixIcon || filled($suffix);
$hasAlpineDisabledClasses = filled($alpineDisabled);
$hasAlpineValidClasses = filled($alpineValid);
$hasAlpineClasses = $hasAlpineDisabledClasses || $hasAlpineValidClasses;
$wireTarget = $attributes->whereStartsWith(['wire:target'])->first();
$hasLoadingIndicator = filled($wireTarget);
if ($hasLoadingIndicator) {
$loadingIndicatorTarget = html_entity_decode($wireTarget, ENT_QUOTES);
}
@endphp
except(['wire:target', 'tabindex'])
->class([
'fi-input-wrp',
'fi-disabled' => (! $hasAlpineClasses) && $disabled,
'fi-invalid' => (! $hasAlpineClasses) && (! $valid),
])
}}
>
@if ($hasPrefix || $hasLoadingIndicator)
$hasPrefix,
'fi-inline' => $inlinePrefix,
'fi-input-wrp-prefix-has-label' => filled($prefix),
])
>
@if (count($prefixActions))
@foreach ($prefixActions as $prefixAction)
{{ $prefixAction }}
@endforeach
@endif
{{
\Filament\Support\generate_icon_html($prefixIcon, $prefixIconAlias, (new \Illuminate\View\ComponentAttributeBag)
->merge([
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $hasLoadingIndicator,
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : false,
], escape: false)
->color(IconComponent::class, $prefixIconColor))
}}
@if ($hasLoadingIndicator)
{{
\Filament\Support\generate_loading_indicator_html((new \Illuminate\View\ComponentAttributeBag([
'wire:loading.delay.' . config('filament.livewire_loading_delay', 'default') => $hasPrefix,
'wire:target' => $hasPrefix ? $loadingIndicatorTarget : null,
]))->color(IconComponent::class, 'gray'))
}}
@endif
@if (filled($prefix))
{{ $prefix }}
@endif
@endif
$hasLoadingIndicator && (! $hasPrefix) && $inlinePrefix,
])
>
{{ $slot }}
@if ($hasSuffix)
$inlineSuffix,
'fi-input-wrp-suffix-has-label' => filled($suffix),
])
>
@if (filled($suffix))
{{ $suffix }}
@endif
{{
\Filament\Support\generate_icon_html($suffixIcon, $suffixIconAlias, (new \Illuminate\View\ComponentAttributeBag)
->merge([
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $hasLoadingIndicator,
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : false,
], escape: false)
->color(IconComponent::class, $suffixIconColor))
}}
@if (count($suffixActions))
@foreach ($suffixActions as $suffixAction)
{{ $suffixAction }}
@endforeach
@endif
@endif