2020-02-28 16:39:47 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
@mouseenter="onMouseenter"
|
|
|
|
@mouseleave="onMouseleave"
|
|
|
|
>
|
2020-11-24 12:52:01 +00:00
|
|
|
<button
|
2020-02-28 16:39:47 +00:00
|
|
|
ref="trigger"
|
2022-04-20 16:57:01 +00:00
|
|
|
class="button-unstyled popover-trigger-button"
|
2021-02-03 07:18:44 +00:00
|
|
|
type="button"
|
2021-02-25 08:56:16 +00:00
|
|
|
@click="onClick"
|
2020-02-28 16:39:47 +00:00
|
|
|
>
|
|
|
|
<slot name="trigger" />
|
2020-11-24 12:52:01 +00:00
|
|
|
</button>
|
2020-02-28 16:39:47 +00:00
|
|
|
<div
|
|
|
|
v-if="!hidden"
|
|
|
|
ref="content"
|
|
|
|
:style="styles"
|
|
|
|
class="popover"
|
2020-07-03 09:56:31 +00:00
|
|
|
:class="popoverClass || 'popover-default'"
|
2020-02-28 16:39:47 +00:00
|
|
|
>
|
|
|
|
<slot
|
|
|
|
name="content"
|
|
|
|
class="popover-inner"
|
|
|
|
:close="hidePopover"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script src="./popover.js" />
|
|
|
|
|
2020-10-19 19:35:46 +00:00
|
|
|
<style lang="scss">
|
2020-02-28 16:39:47 +00:00
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
2020-11-24 19:35:14 +00:00
|
|
|
.popover-trigger-button {
|
2022-02-03 20:10:45 +00:00
|
|
|
display: inline-block;
|
2020-11-24 19:35:14 +00:00
|
|
|
}
|
|
|
|
|
2020-02-28 16:39:47 +00:00
|
|
|
.popover {
|
2022-04-08 10:31:29 +00:00
|
|
|
z-index: 500;
|
2020-02-28 16:39:47 +00:00
|
|
|
position: absolute;
|
|
|
|
min-width: 0;
|
2020-07-03 09:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.popover-default {
|
2020-02-28 16:39:47 +00:00
|
|
|
transition: opacity 0.3s;
|
|
|
|
|
2022-04-11 20:49:46 +00:00
|
|
|
&:after {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 3;
|
|
|
|
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
|
|
|
|
box-shadow: var(--panelShadow);
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
2020-02-28 16:39:47 +00:00
|
|
|
border-radius: $fallback--btnRadius;
|
|
|
|
border-radius: var(--btnRadius, $fallback--btnRadius);
|
|
|
|
|
|
|
|
background-color: $fallback--bg;
|
|
|
|
background-color: var(--popover, $fallback--bg);
|
|
|
|
color: $fallback--text;
|
|
|
|
color: var(--popoverText, $fallback--text);
|
|
|
|
--faint: var(--popoverFaintText, $fallback--faint);
|
|
|
|
--faintLink: var(--popoverFaintLink, $fallback--faint);
|
|
|
|
--lightText: var(--popoverLightText, $fallback--lightText);
|
|
|
|
--postLink: var(--popoverPostLink, $fallback--link);
|
|
|
|
--postFaintLink: var(--popoverPostFaintLink, $fallback--link);
|
|
|
|
--icon: var(--popoverIcon, $fallback--icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
.dropdown-menu {
|
|
|
|
display: block;
|
|
|
|
padding: .5rem 0;
|
2022-04-10 19:09:46 +00:00
|
|
|
font-size: 1em;
|
2020-02-28 16:39:47 +00:00
|
|
|
text-align: left;
|
|
|
|
list-style: none;
|
|
|
|
max-width: 100vw;
|
2022-04-11 20:18:46 +00:00
|
|
|
z-index: 200;
|
2020-02-28 16:39:47 +00:00
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
.dropdown-divider {
|
|
|
|
height: 0;
|
|
|
|
margin: .5rem 0;
|
|
|
|
overflow: hidden;
|
|
|
|
border-top: 1px solid $fallback--border;
|
|
|
|
border-top: 1px solid var(--border, $fallback--border);
|
|
|
|
}
|
|
|
|
|
|
|
|
.dropdown-item {
|
|
|
|
line-height: 21px;
|
2022-04-20 16:44:31 +00:00
|
|
|
overflow: hidden;
|
2020-02-28 16:39:47 +00:00
|
|
|
display: block;
|
2022-04-20 21:21:46 +00: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;
|
|
|
|
border-radius: 0px;
|
|
|
|
background-color: transparent;
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2020-12-03 09:57:17 +00:00
|
|
|
box-sizing: border-box;
|
2020-02-28 16:39:47 +00:00
|
|
|
|
|
|
|
--btnText: var(--popoverText, $fallback--text);
|
|
|
|
|
|
|
|
&-icon {
|
2020-10-19 19:35:46 +00:00
|
|
|
svg {
|
2021-02-25 08:56:16 +00:00
|
|
|
width: 22px;
|
|
|
|
margin-right: 0.75rem;
|
2020-02-28 16:39:47 +00:00
|
|
|
color: var(--menuPopoverIcon, $fallback--icon)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:active, &:hover {
|
|
|
|
background-color: $fallback--lightBg;
|
|
|
|
background-color: var(--selectedMenuPopover, $fallback--lightBg);
|
2022-04-11 20:49:46 +00:00
|
|
|
box-shadow: none;
|
|
|
|
--btnText: var(--selectedMenuPopoverText, $fallback--link);
|
2020-02-28 16:39:47 +00:00
|
|
|
--faint: var(--selectedMenuPopoverFaintText, $fallback--faint);
|
|
|
|
--faintLink: var(--selectedMenuPopoverFaintLink, $fallback--faint);
|
|
|
|
--lightText: var(--selectedMenuPopoverLightText, $fallback--lightText);
|
|
|
|
--icon: var(--selectedMenuPopoverIcon, $fallback--icon);
|
2020-10-19 19:35:46 +00:00
|
|
|
svg {
|
2020-02-28 16:39:47 +00:00
|
|
|
color: var(--selectedMenuPopoverIcon, $fallback--icon);
|
2022-04-11 20:49:46 +00:00
|
|
|
--icon: var(--selectedMenuPopoverIcon, $fallback--icon);
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-25 08:56:16 +00: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;
|
|
|
|
border-radius: 0px;
|
|
|
|
background-color: $fallback--fg;
|
|
|
|
background-color: var(--input, $fallback--fg);
|
|
|
|
box-shadow: 0px 0px 2px black inset;
|
|
|
|
box-shadow: var(--inputShadow);
|
|
|
|
margin-right: 0.75em;
|
|
|
|
|
|
|
|
&.menu-checkbox-checked::after {
|
|
|
|
font-size: 1.25em;
|
|
|
|
content: '✓';
|
|
|
|
}
|
|
|
|
|
2022-04-20 16:44:31 +00:00
|
|
|
&.-radio {
|
|
|
|
border-radius: 9999px;
|
|
|
|
|
|
|
|
&.menu-checkbox-checked::after {
|
|
|
|
font-size: 2em;
|
|
|
|
content: '•';
|
|
|
|
}
|
2021-02-25 08:56:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
2022-04-07 00:04:36 +00:00
|
|
|
|
|
|
|
.button-default.dropdown-item {
|
|
|
|
&,
|
|
|
|
i[class*=icon-] {
|
|
|
|
color: $fallback--text;
|
|
|
|
color: var(--btnText, $fallback--text);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:active {
|
2022-04-07 02:50:01 +00:00
|
|
|
background-color: $fallback--lightBg;
|
|
|
|
background-color: var(--selectedMenuPopover, $fallback--lightBg);
|
|
|
|
color: $fallback--link;
|
|
|
|
color: var(--selectedMenuPopoverText, $fallback--link);
|
2022-04-07 00:04:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
color: $fallback--text;
|
|
|
|
color: var(--btnDisabledText, $fallback--text);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.toggled {
|
|
|
|
color: $fallback--text;
|
|
|
|
color: var(--btnToggledText, $fallback--text);
|
|
|
|
}
|
|
|
|
}
|
2020-02-28 16:39:47 +00:00
|
|
|
}
|
|
|
|
</style>
|