New Initial Commit
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Filament\Support\View\Components\BadgeComponent;
|
||||
use Illuminate\View\ComponentAttributeBag;
|
||||
?>
|
||||
|
||||
<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;
|
||||
|
||||
$__newAttributes = [];
|
||||
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
|
||||
'color' => 'primary',
|
||||
'deleteButton' => null,
|
||||
'disabled' => false,
|
||||
'form' => null,
|
||||
'formId' => null,
|
||||
'href' => null,
|
||||
'icon' => null,
|
||||
'iconAlias' => null,
|
||||
'iconPosition' => IconPosition::Before,
|
||||
'iconSize' => null,
|
||||
'keyBindings' => null,
|
||||
'loadingIndicator' => true,
|
||||
'size' => Size::Medium,
|
||||
'spaMode' => null,
|
||||
'tag' => 'span',
|
||||
'target' => null,
|
||||
'tooltip' => null,
|
||||
'type' => 'button',
|
||||
]));
|
||||
|
||||
foreach ($attributes->all() as $__key => $__value) {
|
||||
if (in_array($__key, $__propNames)) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
} else {
|
||||
$__newAttributes[$__key] = $__value;
|
||||
}
|
||||
}
|
||||
|
||||
$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);
|
||||
|
||||
unset($__propNames);
|
||||
unset($__newAttributes);
|
||||
|
||||
foreach (array_filter(([
|
||||
'color' => 'primary',
|
||||
'deleteButton' => null,
|
||||
'disabled' => false,
|
||||
'form' => null,
|
||||
'formId' => null,
|
||||
'href' => null,
|
||||
'icon' => null,
|
||||
'iconAlias' => null,
|
||||
'iconPosition' => IconPosition::Before,
|
||||
'iconSize' => null,
|
||||
'keyBindings' => null,
|
||||
'loadingIndicator' => true,
|
||||
'size' => Size::Medium,
|
||||
'spaMode' => null,
|
||||
'tag' => 'span',
|
||||
'target' => null,
|
||||
'tooltip' => null,
|
||||
'type' => 'button',
|
||||
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
|
||||
$$__key = $$__key ?? $__value;
|
||||
}
|
||||
|
||||
$__defined_vars = get_defined_vars();
|
||||
|
||||
foreach ($attributes->all() as $__key => $__value) {
|
||||
if (array_key_exists($__key, $__defined_vars)) unset($$__key);
|
||||
}
|
||||
|
||||
unset($__defined_vars, $__key, $__value); ?>
|
||||
|
||||
<?php
|
||||
if (! $iconPosition instanceof IconPosition) {
|
||||
$iconPosition = filled($iconPosition) ? (IconPosition::tryFrom($iconPosition) ?? $iconPosition) : null;
|
||||
}
|
||||
|
||||
if (! $size instanceof Size) {
|
||||
$size = filled($size) ? (Size::tryFrom($size) ?? $size) : null;
|
||||
}
|
||||
|
||||
if (filled($iconSize) && (! $iconSize instanceof IconSize)) {
|
||||
$iconSize = IconSize::tryFrom($iconSize) ?? $iconSize;
|
||||
}
|
||||
|
||||
$isDeletable = count($deleteButton?->attributes->getAttributes() ?? []) > 0;
|
||||
|
||||
$wireTarget = $loadingIndicator ? $attributes->whereStartsWith(['wire:target', 'wire:click'])->filter(fn ($value): bool => filled($value))->first() : null;
|
||||
|
||||
$hasLoadingIndicator = filled($wireTarget) || ($type === 'submit' && filled($form));
|
||||
|
||||
if ($hasLoadingIndicator) {
|
||||
$loadingIndicatorTarget = html_entity_decode($wireTarget ?: $form, ENT_QUOTES);
|
||||
}
|
||||
|
||||
$hasTooltip = filled($tooltip);
|
||||
?>
|
||||
|
||||
<<?php echo e($tag); ?>
|
||||
|
||||
<?php if(($tag === 'a') && (! ($disabled && $hasTooltip))): ?>
|
||||
<?php echo e(\Filament\Support\generate_href_html($href, $target === '_blank', $spaMode)); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if($keyBindings): ?>
|
||||
x-bind:id="$id('key-bindings')"
|
||||
x-mousetrap.global.<?php echo e(collect($keyBindings)->map(fn (string $keyBinding): string => str_replace('+', '-', $keyBinding))->implode('.')); ?>="document.getElementById($el.id)?.click()"
|
||||
<?php endif; ?>
|
||||
<?php if($hasTooltip): ?>
|
||||
x-tooltip="{
|
||||
content: <?php echo \Illuminate\Support\Js::from($tooltip)->toHtml() ?>,
|
||||
theme: $store.theme,
|
||||
allowHTML: <?php echo \Illuminate\Support\Js::from($tooltip instanceof \Illuminate\Contracts\Support\Htmlable)->toHtml() ?>,
|
||||
}"
|
||||
<?php endif; ?>
|
||||
<?php echo e($attributes
|
||||
->merge([
|
||||
'aria-disabled' => $disabled ? 'true' : null,
|
||||
'disabled' => $disabled && blank($tooltip),
|
||||
'form' => $tag === 'button' ? $formId : null,
|
||||
'type' => $tag === 'button' ? $type : null,
|
||||
'wire:loading.attr' => $tag === 'button' ? 'disabled' : null,
|
||||
'wire:target' => ($hasLoadingIndicator && $loadingIndicatorTarget) ? $loadingIndicatorTarget : null,
|
||||
], escape: false)
|
||||
->when(
|
||||
$disabled && $hasTooltip,
|
||||
fn (ComponentAttributeBag $attributes) => $attributes->filter(
|
||||
fn (mixed $value, string $key): bool => ! str($key)->startsWith(['href', 'x-on:', 'wire:click']),
|
||||
),
|
||||
)
|
||||
->class([
|
||||
'fi-badge',
|
||||
'fi-disabled' => $disabled,
|
||||
($size instanceof Size) ? "fi-size-{$size->value}" : (is_string($size) ? $size : ''),
|
||||
])
|
||||
->color(BadgeComponent::class, $color)); ?>
|
||||
|
||||
>
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($iconPosition === IconPosition::Before): ?>
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($icon): ?>
|
||||
<?php echo e(\Filament\Support\generate_icon_html($icon, $iconAlias, (new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $hasLoadingIndicator,
|
||||
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : false,
|
||||
])), size: $iconSize ?? \Filament\Support\Enums\IconSize::Small)); ?>
|
||||
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($hasLoadingIndicator): ?>
|
||||
<?php echo e(\Filament\Support\generate_loading_indicator_html((new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.delay.' . config('filament.livewire_loading_delay', 'default') => '',
|
||||
'wire:target' => $loadingIndicatorTarget,
|
||||
])), size: $iconSize ?? \Filament\Support\Enums\IconSize::Small)); ?>
|
||||
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
|
||||
<span class="fi-badge-label-ctn">
|
||||
<span class="fi-badge-label">
|
||||
<?php echo e($slot); ?>
|
||||
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($isDeletable): ?>
|
||||
<?php
|
||||
$deleteButtonWireTarget = $deleteButton->attributes->whereStartsWith(['wire:target', 'wire:click'])->filter(fn ($value): bool => filled($value))->first();
|
||||
|
||||
$deleteButtonHasLoadingIndicator = filled($deleteButtonWireTarget);
|
||||
|
||||
if ($deleteButtonHasLoadingIndicator) {
|
||||
$deleteButtonLoadingIndicatorTarget = html_entity_decode($deleteButtonWireTarget, ENT_QUOTES);
|
||||
}
|
||||
?>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
<?php echo e($deleteButton->attributes
|
||||
->except(['label'])
|
||||
->class([
|
||||
'fi-badge-delete-btn',
|
||||
])); ?>
|
||||
|
||||
>
|
||||
<?php echo e(\Filament\Support\generate_icon_html(\Filament\Support\Icons\Heroicon::XMark, alias: \Filament\Support\View\SupportIconAlias::BADGE_DELETE_BUTTON, attributes: (new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $deleteButtonHasLoadingIndicator,
|
||||
'wire:target' => $deleteButtonHasLoadingIndicator ? $deleteButtonLoadingIndicatorTarget : false,
|
||||
])), size: \Filament\Support\Enums\IconSize::ExtraSmall)); ?>
|
||||
|
||||
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($deleteButtonHasLoadingIndicator): ?>
|
||||
<?php echo e(\Filament\Support\generate_loading_indicator_html((new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.delay.' . config('filament.livewire_loading_delay', 'default') => '',
|
||||
'wire:target' => $deleteButtonLoadingIndicatorTarget,
|
||||
])), size: \Filament\Support\Enums\IconSize::ExtraSmall)); ?>
|
||||
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(filled($label = $deleteButton->attributes->get('label'))): ?>
|
||||
<span class="fi-sr-only">
|
||||
<?php echo e($label); ?>
|
||||
|
||||
</span>
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
</button>
|
||||
<?php elseif($iconPosition === IconPosition::After): ?>
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($icon): ?>
|
||||
<?php echo e(\Filament\Support\generate_icon_html($icon, $iconAlias, (new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $hasLoadingIndicator,
|
||||
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : false,
|
||||
])), size: $iconSize ?? \Filament\Support\Enums\IconSize::Small)); ?>
|
||||
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
|
||||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($hasLoadingIndicator): ?>
|
||||
<?php echo e(\Filament\Support\generate_loading_indicator_html((new \Illuminate\View\ComponentAttributeBag([
|
||||
'wire:loading.delay.' . config('filament.livewire_loading_delay', 'default') => '',
|
||||
'wire:target' => $loadingIndicatorTarget,
|
||||
])), size: $iconSize ?? \Filament\Support\Enums\IconSize::Small)); ?>
|
||||
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||||
</<?php echo e($tag); ?>>
|
||||
<?php /**PATH /var/www/additional_design/vendor/filament/support/resources/views/components/badge.blade.php ENDPATH**/ ?>
|
||||
Reference in New Issue
Block a user