2020-02-28 16:39:47 +00:00
|
|
|
<template>
|
2022-06-12 16:31:56 +03:00
|
|
|
<span
|
2020-02-28 16:39:47 +00:00
|
|
|
@mouseenter="onMouseenter"
|
|
|
|
@mouseleave="onMouseleave"
|
|
|
|
>
|
2020-11-24 14:52:01 +02:00
|
|
|
<button
|
2020-02-28 16:39:47 +00:00
|
|
|
ref="trigger"
|
2023-05-08 22:04:05 +03:00
|
|
|
class="popover-trigger-button"
|
|
|
|
:class="normalButton ? 'button-default btn' : 'button-unstyled'"
|
2021-02-03 09:18:44 +02:00
|
|
|
type="button"
|
2022-11-07 13:22:40 -05:00
|
|
|
v-bind="triggerAttrs"
|
2021-02-25 10:56:16 +02:00
|
|
|
@click="onClick"
|
2020-02-28 16:39:47 +00:00
|
|
|
>
|
|
|
|
<slot name="trigger" />
|
2020-11-24 14:52:01 +02:00
|
|
|
</button>
|
2022-11-21 22:17:33 +02:00
|
|
|
<teleport
|
|
|
|
:disabled="!teleport"
|
|
|
|
to="#popovers"
|
|
|
|
>
|
2022-06-12 16:31:56 +03:00
|
|
|
<transition name="fade">
|
|
|
|
<div
|
|
|
|
v-if="!hidden"
|
|
|
|
ref="content"
|
|
|
|
:style="styles"
|
|
|
|
class="popover"
|
|
|
|
:class="popoverClass || 'popover-default'"
|
|
|
|
@mouseenter="onMouseenterContent"
|
|
|
|
@mouseleave="onMouseleaveContent"
|
2022-07-31 00:05:26 +03:00
|
|
|
@click="onClickContent"
|
2022-06-12 16:31:56 +03:00
|
|
|
>
|
|
|
|
<slot
|
|
|
|
name="content"
|
|
|
|
class="popover-inner"
|
|
|
|
:close="hidePopover"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2022-05-20 00:56:23 +03:00
|
|
|
</teleport>
|
2022-06-12 16:31:56 +03:00
|
|
|
</span>
|
2020-02-28 16:39:47 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./popover.js" />
|
|
|
|
|
2020-10-19 22:35:46 +03:00
|
|
|
<style lang="scss">
|
2023-01-09 13:02:16 -05:00
|
|
|
@import "../../variables";
|
2020-02-28 16:39:47 +00:00
|
|
|
|
2020-11-24 21:35:14 +02:00
|
|
|
.popover-trigger-button {
|
2022-02-03 22:10:45 +02:00
|
|
|
display: inline-block;
|
2020-11-24 21:35:14 +02:00
|
|
|
}
|
|
|
|
|
2020-02-28 16:39:47 +00:00
|
|
|
.popover {
|
2022-06-22 00:30:10 +03:00
|
|
|
z-index: var(--ZI_popover_override, var(--ZI_popovers));
|
2022-06-13 13:45:04 +03:00
|
|
|
position: fixed;
|
2020-02-28 16:39:47 +00:00
|
|
|
min-width: 0;
|
2022-06-21 01:05:42 +03:00
|
|
|
max-width: calc(100vw - 20px);
|
2024-02-12 17:26:08 +02:00
|
|
|
box-shadow: var(--shadow);
|
2020-07-03 12:56:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
.popover-default {
|
2023-01-09 13:02:16 -05:00
|
|
|
&::after {
|
|
|
|
content: "";
|
2022-04-11 23:49:46 +03:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 3;
|
2024-02-12 17:26:08 +02:00
|
|
|
box-shadow: var(--shadow);
|
2022-04-11 23:49:46 +03:00
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2024-02-13 02:09:43 +02:00
|
|
|
border-radius: var(--roundness);
|
|
|
|
border-color: var(--border);
|
|
|
|
border-style: solid;
|
|
|
|
border-width: 1px;
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.dropdown-menu {
|
|
|
|
display: block;
|
2024-02-13 02:09:43 +02:00
|
|
|
padding: 0;
|
2022-04-10 22:09:46 +03:00
|
|
|
font-size: 1em;
|
2020-02-28 16:39:47 +00:00
|
|
|
text-align: left;
|
|
|
|
list-style: none;
|
|
|
|
max-width: 100vw;
|
2022-06-22 00:30:10 +03:00
|
|
|
z-index: var(--ZI_popover_override, var(--ZI_popovers));
|
2020-02-28 16:39:47 +00:00
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
.dropdown-divider {
|
|
|
|
height: 0;
|
2023-01-09 13:02:16 -05:00
|
|
|
margin: 0.5rem 0;
|
2020-02-28 16:39:47 +00:00
|
|
|
overflow: hidden;
|
|
|
|
border-top: 1px solid $fallback--border;
|
|
|
|
border-top: 1px solid var(--border, $fallback--border);
|
|
|
|
}
|
|
|
|
|
|
|
|
.dropdown-item {
|
|
|
|
line-height: 21px;
|
2022-04-20 19:44:31 +03:00
|
|
|
overflow: hidden;
|
2020-02-28 16:39:47 +00:00
|
|
|
display: block;
|
2022-04-21 00:21:46 +03:00
|
|
|
padding: 0.5em 0.75em;
|
2020-02-28 16:39:47 +00:00
|
|
|
clear: both;
|
|
|
|
font-weight: 400;
|
|
|
|
text-align: inherit;
|
|
|
|
white-space: nowrap;
|
|
|
|
border: none;
|
2023-01-09 13:02:16 -05:00
|
|
|
border-radius: 0;
|
2020-02-28 16:39:47 +00:00
|
|
|
background-color: transparent;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2020-12-03 11:57:17 +02:00
|
|
|
box-sizing: border-box;
|
2020-02-28 16:39:47 +00:00
|
|
|
|
|
|
|
&-icon {
|
2020-10-19 22:35:46 +03:00
|
|
|
svg {
|
2021-02-25 10:56:16 +02:00
|
|
|
width: 22px;
|
|
|
|
margin-right: 0.75rem;
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-23 13:26:05 +03:00
|
|
|
&.-has-submenu {
|
|
|
|
.chevron-icon {
|
|
|
|
margin-right: 0.25rem;
|
|
|
|
margin-left: 2rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-25 10:56:16 +02:00
|
|
|
.menu-checkbox {
|
|
|
|
display: inline-block;
|
|
|
|
vertical-align: middle;
|
|
|
|
min-width: 22px;
|
|
|
|
max-width: 22px;
|
|
|
|
min-height: 22px;
|
|
|
|
max-height: 22px;
|
|
|
|
line-height: 22px;
|
|
|
|
text-align: center;
|
2023-01-09 13:02:16 -05:00
|
|
|
border-radius: 0;
|
2024-02-13 02:09:43 +02:00
|
|
|
box-shadow: var(--shadow);
|
2021-02-25 10:56:16 +02:00
|
|
|
margin-right: 0.75em;
|
|
|
|
|
|
|
|
&.menu-checkbox-checked::after {
|
|
|
|
font-size: 1.25em;
|
2023-01-09 13:02:16 -05:00
|
|
|
content: "✓";
|
2021-02-25 10:56:16 +02:00
|
|
|
}
|
|
|
|
|
2022-04-20 19:44:31 +03:00
|
|
|
&.-radio {
|
|
|
|
border-radius: 9999px;
|
|
|
|
|
|
|
|
&.menu-checkbox-checked::after {
|
|
|
|
font-size: 2em;
|
2023-01-09 13:02:16 -05:00
|
|
|
content: "•";
|
2022-04-20 19:44:31 +03:00
|
|
|
}
|
2021-02-25 10:56:16 +02:00
|
|
|
}
|
|
|
|
}
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|