Skip to content

Commit

Permalink
very wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zepfietje committed Aug 9, 2022
1 parent 8c50355 commit 2379e73
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 183 deletions.
@@ -1,3 +1,5 @@
{{-- TODO: use dropdown here --}}

@php
$user = \Filament\Facades\Filament::auth()->user();
@endphp
Expand Down
29 changes: 16 additions & 13 deletions packages/forms/resources/views/components/builder.blade.php
Expand Up @@ -188,19 +188,22 @@ class="space-y-12"
class="absolute inset-x-0 bottom-0 z-10 flex items-center justify-center h-12 -mb-12"
>
<div x-data class="relative flex justify-center">
<x-forms::icon-button
:label="$getCreateItemBetweenButtonLabel()"
icon="heroicon-o-plus"
x-on:click="$refs.panel.toggle"
type="button"
/>

<x-forms::builder.block-picker
:blocks="$getBlocks()"
:create-after-item="$uuid"
:state-path="$getStatePath()"
class="py-2"
/>
<x-forms::dropdown>
<x-slot name="trigger">
<x-forms::icon-button
:label="$getCreateItemBetweenButtonLabel()"
icon="heroicon-o-plus"
type="button"
/>
</x-slot>

<x-forms::builder.block-picker
:blocks="$getBlocks()"
:create-after-item="$uuid"
:state-path="$getStatePath()"
class="py-2"
/>
</x-forms::dropdown>
</div>
</div>
@endif
Expand Down
Expand Up @@ -4,26 +4,13 @@
'statePath',
])

<div
x-ref="panel"
x-transition
x-cloak
x-float.placement.bottom.flip.offset="{ offset: 8 }"
{{ $attributes->class([
'absolute hidden z-20 w-52 filament-forms-builder-component-block-picker',
]) }}
>
<ul @class([
'py-1 space-y-1 bg-white shadow rounded-xl shadow-xl ring-1 ring-gray-900/10 overflow-hidden rounded-xl',
'dark:bg-gray-700 dark:divide-gray-600 dark:ring-white/20' => config('forms.dark_mode'),
])>
@foreach ($blocks as $block)
<x-forms::dropdown.item
:wire:click="'dispatchFormEvent(\'builder::createItem\', \'' . $statePath . '\', \'' . $block->getName() . '\'' . ($createAfterItem ? ', \'' . $createAfterItem . '\'' : '') . ')'"
:icon="$block->getIcon()"
>
{{ $block->getLabel() }}
</x-forms::dropdown.item>
@endforeach
</ul>
<div {{ $attributes->class('filament-forms-builder-component-block-picker') }}>
@foreach ($blocks as $block)
<x-forms::dropdown.item
:wire:click="'dispatchFormEvent(\'builder::createItem\', \'' . $statePath . '\', \'' . $block->getName() . '\'' . ($createAfterItem ? ', \'' . $createAfterItem . '\'' : '') . ')'"
:icon="$block->getIcon()"
>
{{ $block->getLabel() }}
</x-forms::dropdown.item>
@endforeach
</div>
10 changes: 10 additions & 0 deletions packages/forms/resources/views/components/dropdown/index.blade.php
@@ -0,0 +1,10 @@
@captureSlots([
'trigger',
])

<x-filament-support::dropdown
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->merge($slots)"
:dark-mode="config('forms.dark_mode')"
>
{{ $slot }}
</x-filament-support::dropdown>
58 changes: 23 additions & 35 deletions packages/support/resources/views/components/actions/group.blade.php
Expand Up @@ -7,39 +7,27 @@
'tooltip' => null,
])

<div x-data {{ $attributes->class(['relative']) }}>
<x-filament-support::icon-button
x-on:click="$refs.panel.toggle"
:color="$color"
:dark-mode="$darkMode"
:icon="$icon"
:tooltip="$tooltip"
class="-my-2"
>
<x-slot name="label">
{{ $label }}
</x-slot>
</x-filament-support::icon-button>
<x-filament-support::dropdown
:attributes="$attributes"
:dark-mode="$darkMode"
>
<x-slot name="trigger">
<x-filament-support::icon-button
:color="$color"
:dark-mode="$darkMode"
:icon="$icon"
:tooltip="$tooltip"
class="-my-2"
>
<x-slot name="label">
{{ $label }}
</x-slot>
</x-filament-support::icon-button>
</x-slot>

<div
x-ref="panel"
x-transition
x-cloak
x-float.placement.bottom-end.flip.offset.shift.teleport="{ offset: 8 }"
@class([
'absolute hidden z-20 shadow-xl ring-1 ring-gray-900/10 overflow-hidden rounded-xl w-52 filament-action-group-dropdown',
'dark:ring-white/20' => $darkMode,
])
>
<ul @class([
'py-1 space-y-1 bg-white shadow rounded-xl',
'dark:bg-gray-700 dark:divide-gray-600' => $darkMode,
])>
@foreach ($actions as $action)
@if (! $action->isHidden())
{{ $action }}
@endif
@endforeach
</ul>
</div>
</div>
@foreach ($actions as $action)
@if (! $action->isHidden())
{{ $action }}
@endif
@endforeach
</x-filament-support::dropdown>
@@ -0,0 +1,56 @@
@props([
'darkMode' => false,
'width' => 'sm',
'trigger' => null,
])

<div {{ $attributes->class('relative filament-dropdown') }} x-data="{}">
@isset($trigger)
<div
x-on:click="$refs.panel.toggle"
{{ $trigger->attributes->class(['filament-dropdown-trigger']) }}
>
{{ $trigger }}
</div>
@endisset

<div
x-ref="panel"
x-cloak
x-transition
x-transition:enter="transition"
x-transition:enter-start="-translate-y-1 opacity-0"
x-transition:enter-end="translate-y-0 opacity-100"
x-transition:leave="transition"
x-transition:leave-start="translate-y-0 opacity-100"
x-transition:leave-end="-translate-y-1 opacity-0"
{{-- x-float.placement.bottom.flip.offset="{ offset: 8 }" --}}
{{-- x-float.placement.bottom-start.flip.offset="{ offset: 8 }" --}}
{{-- x-float.placement.bottom-end.flip.offset.shift.teleport="{ offset: 8 }" --}}
{{-- x-float.placement.bottom-end.offset="{ offset: 8 }" --}}
x-float.placement.bottom-end.offset="{ offset: 8 }"
@class([
'filament-dropdown-panel absolute hidden z-20 w-screen shadow-xl rounded-xl top-full',
match ($width) {
'xs' => 'max-w-xs',
'md' => 'max-w-md',
'lg' => 'max-w-lg',
'xl' => 'max-w-xl',
'2xl' => 'max-w-2xl',
'3xl' => 'max-w-3xl',
'4xl' => 'max-w-4xl',
'5xl' => 'max-w-5xl',
'6xl' => 'max-w-6xl',
'7xl' => 'max-w-7xl',
default => 'max-w-sm',
},
])
>
<ul @class([
'py-1 space-y-1 bg-white shadow rounded-xl shadow-xl ring-1 ring-gray-900/10 overflow-hidden rounded-xl',
'dark:bg-gray-700 dark:divide-gray-600 dark:ring-white/20' => $darkMode,
])>
{{ $slot }}
</ul>
</div>
</div>
Expand Up @@ -2,31 +2,12 @@
'actions',
])

<div
x-data="{}"
x-cloak
{{ $attributes->class(['relative filament-tables-bulk-actions']) }}
>
<x-tables::bulk-actions.trigger />
<x-tables::dropdown :attributes="$attributes->class('filament-tables-bulk-actions')">
<x-slot name="trigger">
<x-tables::bulk-actions.trigger />
</x-slot>

<div
x-ref="panel"
x-float.placement.bottom-start.flip.offset="{ offset: 8 }"
x-transition:enter="transition"
x-transition:enter-start="-translate-y-1 opacity-0"
x-transition:enter-end="translate-y-0 opacity-100"
x-transition:leave="transition"
x-transition:leave-start="translate-y-0 opacity-100"
x-transition:leave-end="-translate-y-1 opacity-0"
class="absolute z-10 hidden shadow-xl rounded-xl w-52"
>
<ul @class([
'py-1 space-y-1 overflow-hidden bg-white shadow rounded-xl',
'dark:border-gray-600 dark:bg-gray-700' => config('tables.dark_mode'),
])>
@foreach ($actions as $action)
{{ $action }}
@endforeach
</ul>
</div>
</div>
@foreach ($actions as $action)
{{ $action }}
@endforeach
</x-tables::dropdown>
@@ -1,6 +1,5 @@
<x-tables::icon-button
icon="heroicon-o-dots-vertical"
x-on:click="$refs.panel.toggle"
:label="__('tables::table.buttons.open_actions.label')"
{{ $attributes->class(['filament-tables-bulk-actions-trigger']) }}
/>
@@ -0,0 +1,10 @@
@captureSlots([
'trigger',
])

<x-filament-support::dropdown
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->merge($slots)"
:dark-mode="config('tables.dark_mode')"
>
{{ $slot }}
</x-filament-support::dropdown>
Expand Up @@ -3,54 +3,24 @@
'width' => 'sm',
])

<div
x-data="{}"
{{ $attributes->class(['relative inline-block filament-tables-filters']) }}
>
<x-tables::filters.trigger />
<x-tables::dropdown :attributes="$attributes->class(['filament-tables-filters'])">
<x-slot name="trigger">
<x-tables::filters.trigger />
</x-slot>

<div
x-ref="popoverPanel"
x-float.placement.bottom-end.offset="{ offset: 8 }"
class="px-6 py-4 space-y-6"
wire:ignore.self
wire:key="{{ $this->id }}.table.filters.panel"
x-cloak
x-transition:enter="ease duration-300"
x-transition:enter-start="opacity-0 -translate-y-2"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="ease duration-300"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 translate-y-2"
@class([
'absolute hidden z-10 w-screen top-full transition',
match ($width) {
'xs' => 'max-w-xs',
'md' => 'max-w-md',
'lg' => 'max-w-lg',
'xl' => 'max-w-xl',
'2xl' => 'max-w-2xl',
'3xl' => 'max-w-3xl',
'4xl' => 'max-w-4xl',
'5xl' => 'max-w-5xl',
'6xl' => 'max-w-6xl',
'7xl' => 'max-w-7xl',
default => 'max-w-sm',
},
])
wire:key="{{ $this->id }}.table.filters"
>
<div @class([
'px-6 py-4 bg-white border border-gray-300 space-y-6 shadow-xl rounded-xl',
'dark:bg-gray-800 dark:border-gray-700' => config('tables.dark_mode'),
]) wire:ignore.self>
<x-tables::icon-button
icon="heroicon-o-x"
x-on:click="$refs.popoverPanel.close"
:label=" __('tables::table.filters.buttons.close.label')"
color="secondary"
{{ $attributes->class(['absolute top-3 right-3 rtl:right-auto rtl:left-3']) }}
/>
<x-tables::icon-button
icon="heroicon-o-x"
x-on:click="$refs.popoverPanel.close"
:label=" __('tables::table.filters.buttons.close.label')"
color="secondary"
class="absolute top-3 right-3 rtl:right-auto rtl:left-3"
/>

<x-tables::filters :form="$form" />
</div>
<x-tables::filters :form="$form" />
</div>
</div>
</x-tables::dropdown>
@@ -1,6 +1,5 @@
<x-tables::icon-button
icon="heroicon-o-filter"
x-on:click="$refs.popoverPanel.toggle"
:label="__('tables::table.buttons.filter.label')"
{{ $attributes->class(['filament-tables-filters-trigger']) }}
/>
Expand Up @@ -3,46 +3,16 @@
'width' => 'sm',
])

<div
x-data
{{ $attributes->class(['relative inline-block filament-tables-column-toggling']) }}
>
<x-tables::toggleable.trigger />
<x-tables::dropdown :attributes="$attributes->class(['filament-tables-column-toggling'])">
<x-slot name="trigger">
<x-tables::toggleable.trigger />
</x-slot>

<div
x-ref="toggleablePanel"
x-float.placement.bottom-end.offset="{ offset: 8 }"
class="px-6 py-4 space-y-6"
wire:ignore.self
wire:key="{{ $this->id }}.table.toggle.panel"
x-cloak
x-transition:enter="ease duration-300"
x-transition:enter-start="opacity-0 -translate-y-2"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="ease duration-300"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 translate-y-2"
@class([
'absolute hidden z-10 w-screen top-full transition',
match ($width) {
'xs' => 'max-w-xs',
'md' => 'max-w-md',
'lg' => 'max-w-lg',
'xl' => 'max-w-xl',
'2xl' => 'max-w-2xl',
'3xl' => 'max-w-3xl',
'4xl' => 'max-w-4xl',
'5xl' => 'max-w-5xl',
'6xl' => 'max-w-6xl',
'7xl' => 'max-w-7xl',
default => 'max-w-sm',
},
])
wire:key="{{ $this->id }}.table.toggle.form"
>
<div @class([
'px-6 py-4 bg-white border border-gray-300 space-y-6 shadow-xl rounded-xl',
'dark:bg-gray-800 dark:border-gray-700' => config('tables.dark_mode'),
])>
{{ $form }}
</div>
{{ $form }}
</div>
</div>
</x-tables::dropdown>

0 comments on commit 2379e73

Please sign in to comment.