Skip to content

Commit

Permalink
feat: transition prop can be object
Browse files Browse the repository at this point in the history
  • Loading branch information
nekosaur committed Apr 24, 2021
1 parent f02455b commit a804438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/composables/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { propsFactory } from '@/util'

// Types
import type { PropType } from 'vue'
import type { PropType, TransitionProps } from 'vue'

export const makeTransitionProps = propsFactory({
transition: {
type: [Boolean, String] as PropType<string | false>,
type: [Boolean, String, Object] as PropType<string | false | TransitionProps>,
default: 'fade-transition',
validator: val => val !== true,
},
Expand Down
6 changes: 3 additions & 3 deletions packages/vuetify/src/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,15 @@ export function flattenFragments (nodes: VNode[]): VNode[] {
}

export function maybeTransition <T extends VNode | VNode[] | undefined> (
props: { transition?: string | boolean },
props: { transition?: string | boolean | TransitionProps },
data: TransitionProps,
vNodes: T
): VNode | T {
if (!props.transition) return vNodes
if (!props.transition || typeof props.transition === 'boolean') return vNodes

return h(
Transition,
mergeProps({ name: props.transition }, data as any) as TransitionProps,
mergeProps(typeof props.transition === 'string' ? { name: props.transition } : props.transition as any, data as any),
() => vNodes
)
}
Expand Down

0 comments on commit a804438

Please sign in to comment.