Skip to content

Commit 803c20a

Browse files
anthonyfrancbenjamincanac
andauthoredSep 20, 2024··
fix(Modal/Slideover): bind transition class to TransitionChild for Vue 3.5 (#2227)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed
 

‎src/runtime/components/overlays/Modal.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<TransitionRoot :appear="appear" :show="isOpen" as="template" @after-leave="onAfterLeave">
33
<HDialog :class="ui.wrapper" v-bind="attrs" @close="close">
4-
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
4+
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition" :class="ui.overlay.transition.enterFrom">
55
<div :class="[ui.overlay.base, ui.overlay.background]" />
66
</TransitionChild>
77

88
<div :class="ui.inner">
99
<div :class="[ui.container, !fullscreen && ui.padding]">
10-
<TransitionChild as="template" :appear="appear" v-bind="transitionClass">
10+
<TransitionChild as="template" :appear="appear" v-bind="transitionClass" :class="transitionClass.enterFrom">
1111
<HDialogPanel
1212
:class="[
1313
ui.base,
@@ -97,7 +97,7 @@ export default defineComponent({
9797
9898
const transitionClass = computed(() => {
9999
if (!props.transition) {
100-
return {}
100+
return {} as typeof ui.value.transition
101101
}
102102
103103
return {

‎src/runtime/components/overlays/Slideover.vue

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<TransitionRoot as="template" :appear="appear" :show="isOpen" @after-leave="onAfterLeave">
33
<HDialog :class="[ui.wrapper, { 'justify-end': side === 'right' }, { 'items-end': side === 'bottom' }]" v-bind="attrs" @close="close">
4-
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
4+
<TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition" :class="ui.overlay.transition.enterFrom">
55
<div :class="[ui.overlay.base, ui.overlay.background]" />
66
</TransitionChild>
77

8-
<TransitionChild as="template" :appear="appear" v-bind="transitionClass">
8+
<TransitionChild as="template" :appear="appear" v-bind="transitionClass" :class="transitionClass.enterFrom">
99
<HDialogPanel :class="[ui.base, sideType === 'horizontal' ? [ui.width, 'h-full'] : [ui.height, 'w-full'], ui.background, ui.ring, ui.rounded, ui.padding, ui.shadow]">
1010
<slot />
1111
</HDialogPanel>
@@ -86,7 +86,12 @@ export default defineComponent({
8686
8787
const transitionClass = computed(() => {
8888
if (!props.transition) {
89-
return {}
89+
return {} as typeof ui.value.transition & {
90+
enterFrom: string
91+
enterTo: string
92+
leaveFrom: string
93+
leaveTo: string
94+
}
9095
}
9196
9297
let enterFrom, leaveTo
@@ -120,6 +125,7 @@ export default defineComponent({
120125
leaveTo
121126
}
122127
})
128+
123129
const sideType = computed(() => {
124130
switch (props.side) {
125131
case 'left':

0 commit comments

Comments
 (0)
Please sign in to comment.