Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Popover): ability to add overlay #1014

Merged
merged 9 commits into from
Nov 23, 2023
8 changes: 8 additions & 0 deletions src/runtime/components/overlays/Popover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
</slot>
</HPopoverButton>

<Transition v-if="overlay" appear v-bind="ui.overlay.transition">
<div v-if="(open !== undefined) ? open : headlessOpen" :class="[ui.overlay.base, ui.overlay.background]" />
connerblanton marked this conversation as resolved.
Show resolved Hide resolved
</Transition>

<div v-if="(open !== undefined) ? open : headlessOpen" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
<Transition appear v-bind="ui.transition">
<div>
Expand Down Expand Up @@ -72,6 +76,10 @@ export default defineComponent({
type: Number,
default: 0
},
overlay: {
type: Boolean,
default: false
},
popper: {
type: Object as PropType<PopperOptions>,
default: () => ({})
Expand Down
14 changes: 13 additions & 1 deletion src/runtime/ui.config/overlays/popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ export default {
leaveFromClass: 'opacity-100 translate-y-0',
leaveToClass: 'opacity-0 translate-y-1'
},
overlay: {
base: 'fixed inset-0 transition-opacity',
background: 'bg-gray-200/75 dark:bg-gray-800/75',
transition: {
enterActiveClass: 'ease-out duration-200',
enterFromClass: 'opacity-0',
enterToClass: 'opacity-100',
leaveActiveClass: 'ease-in duration-150',
leaveFromClass: 'opacity-100',
leaveToClass: 'opacity-0'
}
},
popper: {
strategy: 'fixed'
},
arrow
}
}