This commit is contained in:
2025-10-22 20:08:22 +05:00
commit 736e3bef18
2573 changed files with 120385 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
@props([
'alpineValid' => null,
'valid' => true,
])
@php
$hasAlpineValidClasses = filled($alpineValid);
@endphp
<input
type="checkbox"
@if ($hasAlpineValidClasses)
x-bind:class="{
'fi-valid': {{ $alpineValid }},
'fi-invalid': {{ "(! {$alpineValid})" }},
}"
@endif
{{
$attributes
->class([
'fi-checkbox-input',
'fi-valid' => (! $hasAlpineValidClasses) && $valid,
'fi-invalid' => (! $hasAlpineValidClasses) && (! $valid),
])
}}
/>

View File

@@ -0,0 +1,14 @@
@props([
'inlinePrefix' => false,
'inlineSuffix' => false,
])
<input
{{
$attributes->class([
'fi-input',
'fi-input-has-inline-prefix' => $inlinePrefix,
'fi-input-has-inline-suffix' => $inlineSuffix,
])
}}
/>

View File

@@ -0,0 +1,42 @@
@props([
'length' => 6,
])
<div
x-data="{ currentNumberOfDigits: null }"
{{
$attributes
->class([
'fi-one-time-code-input-ctn',
])
}}
>
@foreach (range(1, $length) as $digit)
<div
x-bind:class="{
'fi-active':
currentNumberOfDigits !== null &&
currentNumberOfDigits >= {{ $digit }},
}"
class="fi-one-time-code-input-digit-field"
></div>
@endforeach
<input
autocomplete="one-time-code"
inputmode="numeric"
minlength="{{ $length }}"
maxlength="{{ $length }}"
pattern="\d{{ '{' . $length . '}' }}"
type="text"
x-data="{}"
x-on:focus="currentNumberOfDigits = $el.value.length"
x-on:blur="currentNumberOfDigits = null"
x-on:input="
$el.value = $el.value.replace(/\D/g, '')
currentNumberOfDigits = $el.value.length
"
x-bind:class="{ 'fi-valid': currentNumberOfDigits >= {{ $length }} }"
class="fi-one-time-code-input"
/>
</div>

View File

@@ -0,0 +1,14 @@
@props([
'valid' => true,
])
<input
type="radio"
{{
$attributes
->class([
'fi-radio-input',
'fi-invalid' => ! $valid,
])
}}
/>

View File

@@ -0,0 +1,15 @@
@props([
'inlinePrefix' => false,
'inlineSuffix' => false,
])
<select
{{
$attributes->class([
'fi-select-input',
'fi-select-input-has-inline-prefix' => $inlinePrefix,
])
}}
>
{{ $slot }}
</select>

View File

@@ -0,0 +1,163 @@
@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
<div
@if ($hasAlpineClasses)
x-bind:class="{
{{ $hasAlpineDisabledClasses ? "'fi-disabled': {$alpineDisabled}," : null }}
{{ $hasAlpineValidClasses ? "'fi-invalid': ! ({$alpineValid})," : null }}
}"
@endif
{{
$attributes
->except(['wire:target', 'tabindex'])
->class([
'fi-input-wrp',
'fi-disabled' => (! $hasAlpineClasses) && $disabled,
'fi-invalid' => (! $hasAlpineClasses) && (! $valid),
])
}}
>
@if ($hasPrefix || $hasLoadingIndicator)
<div
@if (! $hasPrefix)
wire:loading.delay.{{ config('filament.livewire_loading_delay', 'default') }}.flex
wire:target="{{ $loadingIndicatorTarget }}"
wire:key="{{ \Illuminate\Support\Str::random() }}" {{-- Makes sure the loading indicator gets hidden again. --}}
@endif
@class([
'fi-input-wrp-prefix',
'fi-input-wrp-prefix-has-content' => $hasPrefix,
'fi-inline' => $inlinePrefix,
'fi-input-wrp-prefix-has-label' => filled($prefix),
])
>
@if (count($prefixActions))
<div class="fi-input-wrp-actions">
@foreach ($prefixActions as $prefixAction)
{{ $prefixAction }}
@endforeach
</div>
@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))
<span class="fi-input-wrp-label">
{{ $prefix }}
</span>
@endif
</div>
@endif
<div
@if ($hasLoadingIndicator && (! $hasPrefix))
@if ($inlinePrefix)
wire:loading.delay.{{ config('filament.livewire_loading_delay', 'default') }}.class.remove="ps-3"
@endif
wire:target="{{ $loadingIndicatorTarget }}"
@endif
@class([
'fi-input-wrp-content-ctn',
'fi-input-wrp-content-ctn-ps' => $hasLoadingIndicator && (! $hasPrefix) && $inlinePrefix,
])
>
{{ $slot }}
</div>
@if ($hasSuffix)
<div
@class([
'fi-input-wrp-suffix',
'fi-inline' => $inlineSuffix,
'fi-input-wrp-suffix-has-label' => filled($suffix),
])
>
@if (filled($suffix))
<span class="fi-input-wrp-label">
{{ $suffix }}
</span>
@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))
<div class="fi-input-wrp-actions">
@foreach ($suffixActions as $suffixAction)
{{ $suffixAction }}
@endforeach
</div>
@endif
</div>
@endif
</div>