2019-10-18 07:04:24 -04:00
|
|
|
<template>
|
2019-10-18 12:22:12 -04:00
|
|
|
<div
|
|
|
|
|
v-show="isOpen"
|
2020-05-24 02:06:55 +03:00
|
|
|
v-body-scroll-lock="isOpen && !noBackground"
|
2019-10-21 15:36:03 -04:00
|
|
|
class="modal-view"
|
2020-05-24 02:06:55 +03:00
|
|
|
:class="classes"
|
2019-10-21 20:52:31 -04:00
|
|
|
@click.self="$emit('backdropClicked')"
|
2019-10-18 12:22:12 -04:00
|
|
|
>
|
|
|
|
|
<slot />
|
|
|
|
|
</div>
|
2019-10-18 07:04:24 -04:00
|
|
|
</template>
|
|
|
|
|
|
2019-10-21 20:53:34 -04:00
|
|
|
<script>
|
|
|
|
|
export default {
|
2022-07-31 12:35:48 +03:00
|
|
|
provide: {
|
|
|
|
|
popoversZLayer: 'modals'
|
|
|
|
|
},
|
2019-10-21 20:53:34 -04:00
|
|
|
props: {
|
|
|
|
|
isOpen: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true
|
2020-05-10 06:46:06 +03:00
|
|
|
},
|
|
|
|
|
noBackground: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
2019-10-21 20:53:34 -04:00
|
|
|
}
|
2020-05-24 02:06:55 +03:00
|
|
|
},
|
2025-02-04 15:23:21 +02:00
|
|
|
emits: ['backdropClicked'],
|
2020-05-24 02:06:55 +03:00
|
|
|
computed: {
|
|
|
|
|
classes () {
|
|
|
|
|
return {
|
|
|
|
|
'modal-background': !this.noBackground,
|
2022-07-31 12:35:48 +03:00
|
|
|
open: this.isOpen
|
2020-05-24 02:06:55 +03:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-21 20:53:34 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2019-10-18 07:04:24 -04:00
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.modal-view {
|
2022-06-22 00:30:10 +03:00
|
|
|
z-index: var(--ZI_modals);
|
2019-10-18 07:07:16 -04:00
|
|
|
position: fixed;
|
2025-03-31 12:41:04 +03:00
|
|
|
inset: 0;
|
2019-10-18 07:07:16 -04:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
overflow: auto;
|
2020-05-10 06:46:06 +03:00
|
|
|
pointer-events: none;
|
2019-10-18 07:07:16 -04:00
|
|
|
animation-duration: 0.2s;
|
|
|
|
|
animation-name: modal-background-fadein;
|
2020-05-24 02:06:55 +03:00
|
|
|
opacity: 0;
|
2019-10-18 07:07:16 -04:00
|
|
|
|
2020-05-10 06:46:06 +03:00
|
|
|
> * {
|
|
|
|
|
pointer-events: initial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.modal-background {
|
|
|
|
|
pointer-events: initial;
|
2023-01-09 13:02:16 -05:00
|
|
|
background-color: rgb(0 0 0 / 50%);
|
2020-05-10 06:46:06 +03:00
|
|
|
}
|
|
|
|
|
|
2020-05-24 02:06:55 +03:00
|
|
|
&.open {
|
|
|
|
|
opacity: 1;
|
2019-10-18 07:04:24 -04:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-21 15:37:14 -04:00
|
|
|
|
|
|
|
|
@keyframes modal-background-fadein {
|
|
|
|
|
from {
|
2023-01-09 13:02:16 -05:00
|
|
|
background-color: rgb(0 0 0 / 0%);
|
2019-10-21 15:37:14 -04:00
|
|
|
}
|
2023-01-09 13:02:16 -05:00
|
|
|
|
2019-10-21 15:37:14 -04:00
|
|
|
to {
|
2023-01-09 13:02:16 -05:00
|
|
|
background-color: rgb(0 0 0 / 50%);
|
2019-10-21 15:37:14 -04:00
|
|
|
}
|
|
|
|
|
}
|
2019-10-18 07:04:24 -04:00
|
|
|
</style>
|