Skip to content

Commit

Permalink
fix(Modal/Slideover): bind transition class to TransitionChild for …
Browse files Browse the repository at this point in the history
…Vue 3.5 (#2227)

Co-authored-by: Benjamin Canac <[email protected]>
  • Loading branch information
anthonyfranc and benjamincanac authored Sep 20, 2024
1 parent 0a054a5 commit 803c20a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/runtime/components/overlays/Modal.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<TransitionRoot :appear="appear" :show="isOpen" as="template" @after-leave="onAfterLeave">
<HDialog :class="ui.wrapper" v-bind="attrs" @close="close">
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition" :class="ui.overlay.transition.enterFrom">
<div :class="[ui.overlay.base, ui.overlay.background]" />
</TransitionChild>

<div :class="ui.inner">
<div :class="[ui.container, !fullscreen && ui.padding]">
<TransitionChild as="template" :appear="appear" v-bind="transitionClass">
<TransitionChild as="template" :appear="appear" v-bind="transitionClass" :class="transitionClass.enterFrom">
<HDialogPanel
:class="[
ui.base,
Expand Down Expand Up @@ -97,7 +97,7 @@ export default defineComponent({
const transitionClass = computed(() => {
if (!props.transition) {
return {}
return {} as typeof ui.value.transition
}
return {
Expand Down
12 changes: 9 additions & 3 deletions src/runtime/components/overlays/Slideover.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<TransitionRoot as="template" :appear="appear" :show="isOpen" @after-leave="onAfterLeave">
<HDialog :class="[ui.wrapper, { 'justify-end': side === 'right' }, { 'items-end': side === 'bottom' }]" v-bind="attrs" @close="close">
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition" :class="ui.overlay.transition.enterFrom">
<div :class="[ui.overlay.base, ui.overlay.background]" />
</TransitionChild>

<TransitionChild as="template" :appear="appear" v-bind="transitionClass">
<TransitionChild as="template" :appear="appear" v-bind="transitionClass" :class="transitionClass.enterFrom">
<HDialogPanel :class="[ui.base, sideType === 'horizontal' ? [ui.width, 'h-full'] : [ui.height, 'w-full'], ui.background, ui.ring, ui.rounded, ui.padding, ui.shadow]">
<slot />
</HDialogPanel>
Expand Down Expand Up @@ -86,7 +86,12 @@ export default defineComponent({
const transitionClass = computed(() => {
if (!props.transition) {
return {}
return {} as typeof ui.value.transition & {
enterFrom: string
enterTo: string
leaveFrom: string
leaveTo: string
}
}
let enterFrom, leaveTo
Expand Down Expand Up @@ -120,6 +125,7 @@ export default defineComponent({
leaveTo
}
})
const sideType = computed(() => {
switch (props.side) {
case 'left':
Expand Down

0 comments on commit 803c20a

Please sign in to comment.