Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Feb 2, 2025
1 parent d30015d commit 3721266
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 29 deletions.
12 changes: 6 additions & 6 deletions docs-assets/app/public/js/filament/support/support.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/support/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/support/resources/css/components/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
}

& .fi-modal-window {
@apply pointer-events-auto duration-300 relative row-start-2 flex w-full cursor-default flex-col bg-white ring-1 shadow-xl ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10;
@apply pointer-events-auto relative row-start-2 flex w-full cursor-default flex-col bg-white ring-1 shadow-xl ring-gray-950/5 duration-300 dark:bg-gray-900 dark:ring-white/10;

&.fi-align-start,
&.fi-align-left {
Expand Down
23 changes: 17 additions & 6 deletions packages/support/resources/js/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ export default ({ id }) => ({

this.isWindowVisible = true

return;
return
}

this.isWindowVisible = false

setTimeout(
() => this.$root?.close(),
this.$refs.window ? ((parseFloat(window.getComputedStyle(this.$refs.window).transitionDuration)) * 1000) : 0,
this.$refs.window
? parseFloat(
window.getComputedStyle(this.$refs.window)
.transitionDuration,
) * 1000
: 0,
)
})
})
Expand All @@ -32,10 +37,16 @@ export default ({ id }) => ({
this.closeQuietly()

setTimeout(
() => this.$refs.windowContainer?.dispatchEvent(
new CustomEvent('modal-closed', { id }),
),
this.$refs.window ? ((parseFloat(window.getComputedStyle(this.$refs.window).transitionDuration)) * 1000) : 0,
() =>
this.$root.dispatchEvent(
new CustomEvent('modal-closed', { id }),
),
this.$refs.window
? parseFloat(
window.getComputedStyle(this.$refs.window)
.transitionDuration,
) * 1000
: 0,
)
},

Expand Down
23 changes: 13 additions & 10 deletions packages/support/resources/views/components/modal/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@

<dialog
x-data="filamentModal({
id: @js($id),
})"
id: @js($id),
})"
@if ($id)
x-on:{{ $closeEventName }}.window="if (($event.detail.id === @js($id)) && isOpen) close()"
x-on:{{ $closeQuietlyEventName }}.window="if (($event.detail.id === @js($id)) && isOpen) closeQuietly()"
Expand All @@ -78,7 +78,8 @@
x-on:{{ $closeQuietlyEventName }}.stop="if (isOpen) closeQuietly()"
x-on:{{ $openEventName }}.stop="if (! isOpen) open()"
@endif
x-on:cancel.prevent {{-- Prevents the dialog from closing when the escape key is pressed, we do that ourselves to properly transition it. --}}
{{-- Prevents the dialog from closing when the escape key is pressed, we do that ourselves to properly transition it. --}}
x-on:cancel.prevent
id="{{ $id }}"
wire:ignore.self
x-trap.noscroll{{ $autofocus ? '' : '.noautofocus' }}="isOpen"
Expand All @@ -90,11 +91,13 @@
@elseif ($heading)
aria-labelledby="{{ "{$id}.heading" }}"
@endif
@class([
'fi-modal',
'fi-modal-slide-over' => $slideOver,
'fi-width-screen' => $width === Width::Screen,
])
{{
$attributes->class([
'fi-modal',
'fi-modal-slide-over' => $slideOver,
'fi-width-screen' => $width === Width::Screen,
])
}}
>
<div
aria-hidden="true"
Expand All @@ -113,10 +116,10 @@ class="fi-modal-close-overlay"
{{ $closeEventHandler }}
"
@endif
{{ $attributes->class([
@class([
'fi-modal-window-ctn',
'fi-clickable' => $closeByClickingAway,
]) }}
])
>
<div
x-show="isWindowVisible"
Expand Down

0 comments on commit 3721266

Please sign in to comment.