Masters and Transaction changes

This commit is contained in:
dhanabalan
2025-03-24 17:23:01 +05:30
parent 04ee0cadd5
commit c631f1f2c0
123 changed files with 6935 additions and 32 deletions

View File

@@ -0,0 +1,71 @@
@php
use Filament\Support\Enums\IconSize;
@endphp
@props([
'color' => 'gray',
'icon' => null,
'iconSize' => IconSize::Medium,
'tag' => 'div',
])
<{{ $tag }}
{{
$attributes
->class([
'fi-dropdown-header flex w-full gap-2 p-3 text-sm',
match ($color) {
'gray' => null,
default => 'fi-color-custom',
},
// @deprecated `fi-dropdown-header-color-*` has been replaced by `fi-color-*` and `fi-color-custom`.
is_string($color) ? "fi-dropdown-header-color-{$color}" : null,
is_string($color) ? "fi-color-{$color}" : null,
])
}}
>
@if (filled($icon))
<x-filament::icon
:icon="$icon"
@class([
'fi-dropdown-header-icon',
match ($iconSize) {
IconSize::Small, 'sm' => 'h-4 w-4',
IconSize::Medium, 'md' => 'h-5 w-5',
IconSize::Large, 'lg' => 'h-6 w-6',
default => $iconSize,
},
match ($color) {
'gray' => 'text-gray-400 dark:text-gray-500',
default => 'text-custom-500 dark:text-custom-400',
},
])
@style([
\Filament\Support\get_color_css_variables(
$color,
shades: [400, 500],
alias: 'dropdown.header.icon',
) => $color !== 'gray',
])
/>
@endif
<span
@class([
'fi-dropdown-header-label flex-1 truncate text-start',
match ($color) {
'gray' => 'text-gray-700 dark:text-gray-200',
default => 'text-custom-600 dark:text-custom-400',
},
])
@style([
\Filament\Support\get_color_css_variables(
$color,
shades: [400, 600],
alias: 'dropdown.header.label',
) => $color !== 'gray',
])
>
{{ $slot }}
</span>
</{{ $tag }}>

View File

@@ -0,0 +1,87 @@
@props([
'availableHeight' => null,
'availableWidth' => null,
'flip' => true,
'maxHeight' => null,
'offset' => 8,
'placement' => null,
'shift' => false,
'size' => false,
'sizePadding' => 16,
'teleport' => false,
'trigger' => null,
'width' => null,
])
@php
use Filament\Support\Enums\MaxWidth;
$sizeConfig = collect([
'availableHeight' => $availableHeight,
'availableWidth' => $availableWidth,
'padding' => $sizePadding,
])->filter()->toJson();
@endphp
<div
x-data="{
toggle: function (event) {
$refs.panel.toggle(event)
},
open: function (event) {
$refs.panel.open(event)
},
close: function (event) {
$refs.panel.close(event)
},
}"
{{ $attributes->class(['fi-dropdown']) }}
>
<div
x-on:click="toggle"
{{ $trigger->attributes->class(['fi-dropdown-trigger flex cursor-pointer']) }}
>
{{ $trigger }}
</div>
@if (! \Filament\Support\is_slot_empty($slot))
<div
x-cloak
x-float{{ $placement ? ".placement.{$placement}" : '' }}{{ $size ? '.size' : '' }}{{ $flip ? '.flip' : '' }}{{ $shift ? '.shift' : '' }}{{ $teleport ? '.teleport' : '' }}{{ $offset ? '.offset' : '' }}="{ offset: {{ $offset }}, {{ $size ? ('size: ' . $sizeConfig) : '' }} }"
x-ref="panel"
x-transition:enter-start="opacity-0"
x-transition:leave-end="opacity-0"
@if ($attributes->has('wire:key'))
wire:ignore.self
wire:key="{{ $attributes->get('wire:key') }}.panel"
@endif
@class([
'fi-dropdown-panel absolute z-10 w-screen divide-y divide-gray-100 rounded-lg bg-white shadow-lg ring-1 ring-gray-950/5 transition dark:divide-white/5 dark:bg-gray-900 dark:ring-white/10',
match ($width) {
// These max width classes need to be `!important` otherwise they will be usurped by the Floating UI "size" middleware.
MaxWidth::ExtraSmall, 'xs' => '!max-w-xs',
MaxWidth::Small, 'sm' => '!max-w-sm',
MaxWidth::Medium, 'md' => '!max-w-md',
MaxWidth::Large, 'lg' => '!max-w-lg',
MaxWidth::ExtraLarge, 'xl' => '!max-w-xl',
MaxWidth::TwoExtraLarge, '2xl' => '!max-w-2xl',
MaxWidth::ThreeExtraLarge, '3xl' => '!max-w-3xl',
MaxWidth::FourExtraLarge, '4xl' => '!max-w-4xl',
MaxWidth::FiveExtraLarge, '5xl' => '!max-w-5xl',
MaxWidth::SixExtraLarge, '6xl' => '!max-w-6xl',
MaxWidth::SevenExtraLarge, '7xl' => '!max-w-7xl',
null => '!max-w-[14rem]',
default => $width,
},
'overflow-y-auto' => $maxHeight || $size,
])
@style([
"max-height: {$maxHeight}" => $maxHeight,
])
>
{{ $slot }}
</div>
@endif
</div>

View File

@@ -0,0 +1,3 @@
<div {{ $attributes->class(['fi-dropdown-list p-1']) }}>
{{ $slot }}
</div>

View File

@@ -0,0 +1,275 @@
@php
use Filament\Support\Enums\IconSize;
@endphp
@props([
'badge' => null,
'badgeColor' => null,
'badgeTooltip' => null,
'color' => 'gray',
'disabled' => false,
'href' => null,
'icon' => null,
'iconAlias' => null,
'iconColor' => null,
'iconSize' => IconSize::Medium,
'image' => null,
'keyBindings' => null,
'loadingIndicator' => true,
'spaMode' => null,
'tag' => 'button',
'target' => null,
'tooltip' => null,
])
@php
$buttonClasses = \Illuminate\Support\Arr::toCssClasses([
'fi-dropdown-list-item flex w-full items-center gap-2 whitespace-nowrap rounded-md p-2 text-sm transition-colors duration-75 outline-none disabled:pointer-events-none disabled:opacity-70',
'pointer-events-none opacity-70' => $disabled,
match ($color) {
'gray' => 'hover:bg-gray-50 focus-visible:bg-gray-50 dark:hover:bg-white/5 dark:focus-visible:bg-white/5',
default => 'fi-color-custom hover:bg-custom-50 focus-visible:bg-custom-50 dark:hover:bg-custom-400/10 dark:focus-visible:bg-custom-400/10',
},
// @deprecated `fi-dropdown-list-item-color-*` has been replaced by `fi-color-*` and `fi-color-custom`.
is_string($color) ? "fi-dropdown-list-item-color-{$color}" : null,
is_string($color) ? "fi-color-{$color}" : null,
]);
$buttonStyles = \Illuminate\Support\Arr::toCssStyles([
\Filament\Support\get_color_css_variables(
$color,
shades: [50, 400],
alias: 'dropdown.list.item',
) => $color !== 'gray',
]);
$iconColor ??= $color;
$iconClasses = \Illuminate\Support\Arr::toCssClasses([
'fi-dropdown-list-item-icon',
match ($iconSize) {
IconSize::Small, 'sm' => 'h-4 w-4',
IconSize::Medium, 'md' => 'h-5 w-5',
IconSize::Large, 'lg' => 'h-6 w-6',
default => $iconSize,
},
match ($iconColor) {
'gray' => 'text-gray-400 dark:text-gray-500',
default => 'text-custom-500 dark:text-custom-400',
},
]);
$iconStyles = \Illuminate\Support\Arr::toCssStyles([
\Filament\Support\get_color_css_variables(
$iconColor,
shades: [400, 500],
alias: 'dropdown.list.item.icon',
) => $iconColor !== 'gray',
]);
$imageClasses = 'fi-dropdown-list-item-image h-5 w-5 rounded-full bg-cover bg-center';
$labelClasses = \Illuminate\Support\Arr::toCssClasses([
'fi-dropdown-list-item-label flex-1 truncate text-start',
match ($color) {
'gray' => 'text-gray-700 dark:text-gray-200',
default => 'text-custom-600 dark:text-custom-400 ',
},
]);
$labelStyles = \Illuminate\Support\Arr::toCssStyles([
\Filament\Support\get_color_css_variables(
$color,
shades: [400, 600],
alias: 'dropdown.list.item.label',
) => $color !== 'gray',
]);
$wireTarget = $loadingIndicator ? $attributes->whereStartsWith(['wire:target', 'wire:click'])->filter(fn ($value): bool => filled($value))->first() : null;
$hasLoadingIndicator = filled($wireTarget);
if ($hasLoadingIndicator) {
$loadingIndicatorTarget = html_entity_decode($wireTarget, ENT_QUOTES);
}
$hasTooltip = filled($tooltip);
@endphp
@if ($tag === 'button')
<button
@if ($keyBindings || $hasTooltip)
x-data="{}"
@endif
@if ($keyBindings)
x-bind:id="$id('key-bindings')"
x-mousetrap.global.{{ collect($keyBindings)->map(fn (string $keyBinding): string => str_replace('+', '-', $keyBinding))->implode('.') }}="document.getElementById($el.id).click()"
@endif
@if ($hasTooltip)
x-tooltip="{
content: @js($tooltip),
theme: $store.theme,
}"
@endif
{{
$attributes
->merge([
'disabled' => $disabled,
'type' => 'button',
'wire:loading.attr' => 'disabled',
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : null,
], escape: false)
->class([$buttonClasses])
->style([$buttonStyles])
}}
>
@if ($icon)
<x-filament::icon
:attributes="
\Filament\Support\prepare_inherited_attributes(
new \Illuminate\View\ComponentAttributeBag([
'alias' => $iconAlias,
'icon' => $icon,
'wire:loading.remove.delay.' . config('filament.livewire_loading_delay', 'default') => $hasLoadingIndicator,
'wire:target' => $hasLoadingIndicator ? $loadingIndicatorTarget : null,
])
)
->class([$iconClasses])
->style([$iconStyles])
"
/>
@endif
@if ($image)
<div
class="{{ $imageClasses }}"
style="background-image: url('{{ $image }}')"
></div>
@endif
@if ($hasLoadingIndicator)
<x-filament::loading-indicator
:attributes="
\Filament\Support\prepare_inherited_attributes(
new \Illuminate\View\ComponentAttributeBag([
'wire:loading.delay.' . config('filament.livewire_loading_delay', 'default') => '',
'wire:target' => $loadingIndicatorTarget,
])
)
->class([$iconClasses])
->style([$iconStyles])
"
/>
@endif
<span class="{{ $labelClasses }}" style="{{ $labelStyles }}">
{{ $slot }}
</span>
@if (filled($badge))
<x-filament::badge
:color="$badgeColor"
size="sm"
:tooltip="$badgeTooltip"
>
{{ $badge }}
</x-filament::badge>
@endif
</button>
@elseif ($tag === 'a')
<a
{{ \Filament\Support\generate_href_html($href, $target === '_blank', $spaMode) }}
@if ($keyBindings || $hasTooltip)
x-data="{}"
@endif
@if ($keyBindings)
x-bind:id="$id('key-bindings')"
x-mousetrap.global.{{ collect($keyBindings)->map(fn (string $keyBinding): string => str_replace('+', '-', $keyBinding))->implode('.') }}="document.getElementById($el.id).click()"
@endif
@if ($hasTooltip)
x-tooltip="{
content: @js($tooltip),
theme: $store.theme,
}"
@endif
{{
$attributes
->class([$buttonClasses])
->style([$buttonStyles])
}}
>
@if ($icon)
<x-filament::icon
:alias="$iconAlias"
:icon="$icon"
:class="$iconClasses"
:style="$iconStyles"
/>
@endif
@if ($image)
<div
class="{{ $imageClasses }}"
style="background-image: url('{{ $image }}')"
></div>
@endif
<span class="{{ $labelClasses }}" style="{{ $labelStyles }}">
{{ $slot }}
</span>
@if (filled($badge))
<x-filament::badge :color="$badgeColor" size="sm">
{{ $badge }}
</x-filament::badge>
@endif
</a>
@elseif ($tag === 'form')
<form
{{ $attributes->only(['action', 'class', 'method', 'wire:submit']) }}
>
@csrf
<button
@if ($keyBindings || $hasTooltip)
x-data="{}"
@endif
@if ($keyBindings)
x-bind:id="$id('key-bindings')"
x-mousetrap.global.{{ collect($keyBindings)->map(fn (string $keyBinding): string => str_replace('+', '-', $keyBinding))->implode('.') }}="document.getElementById($el.id).click()"
@endif
@if ($hasTooltip)
x-tooltip="{
content: @js($tooltip),
theme: $store.theme,
}"
@endif
type="submit"
{{
$attributes
->except(['action', 'class', 'method', 'wire:submit'])
->class([$buttonClasses])
->style([$buttonStyles])
}}
>
@if ($icon)
<x-filament::icon
:alias="$iconAlias"
:icon="$icon"
:class="$iconClasses"
:style="$iconStyles"
/>
@endif
<span class="{{ $labelClasses }}" style="{{ $labelStyles }}">
{{ $slot }}
</span>
@if (filled($badge))
<x-filament::badge :color="$badgeColor" size="sm">
{{ $badge }}
</x-filament::badge>
@endif
</button>
</form>
@endif