Add parent div on slot to allow custom trigger on Dropdown and transition prop + element to Dropdown content

This commit is contained in:
CaptainZiboo
2022-07-22 18:49:59 +02:00
parent dc22502b3b
commit 3e76b9d06c
2 changed files with 5120 additions and 50 deletions

5142
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
<template>
<div class="inline-flex relative" ref="wrapper">
<div class="inline-flex items-center">
<slot name="trigger" :show="onShow" :hide="onHide" :toggle="onToggle">
<Button @click="onToggle">
{{ text }}
@@ -8,9 +9,12 @@
</template>
</Button>
</slot>
<div ref="content" :style="contentStyles" :class="[{ hidden: !visible }, contentClasses]">
</div>
<Transition :name="transition">
<div ref="content" v-if="visible" :style="contentStyles" :class="[{ hidden: !visible }, contentClasses]">
<slot />
</div>
</Transition>
</div>
</template>
<script lang="ts" setup>
@@ -36,6 +40,10 @@ const props = defineProps({
type: String ,
default: '',
},
transition: {
type: String ,
default: '',
},
})
const content = ref<HTMLDivElement>()