logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

popover.vue (2979B)


  1. <template>
  2. <span
  3. @mouseenter="onMouseenter"
  4. @mouseleave="onMouseleave"
  5. >
  6. <button
  7. ref="trigger"
  8. class="popover-trigger-button"
  9. :class="normalButton ? 'button-default btn' : 'button-unstyled'"
  10. type="button"
  11. v-bind="triggerAttrs"
  12. @click="onClick"
  13. >
  14. <slot name="trigger" />
  15. </button>
  16. <teleport
  17. :disabled="!teleport"
  18. to="#popovers"
  19. >
  20. <transition name="fade">
  21. <div
  22. v-if="!hidden"
  23. ref="content"
  24. :style="styles"
  25. class="popover"
  26. :class="popoverClass || 'popover-default'"
  27. @mouseenter="onMouseenterContent"
  28. @mouseleave="onMouseleaveContent"
  29. @click="onClickContent"
  30. >
  31. <slot
  32. name="content"
  33. class="popover-inner"
  34. :close="hidePopover"
  35. />
  36. </div>
  37. </transition>
  38. </teleport>
  39. </span>
  40. </template>
  41. <script src="./popover.js" />
  42. <style lang="scss">
  43. .popover-trigger-button {
  44. display: inline-block;
  45. }
  46. .popover {
  47. z-index: var(--ZI_popover_override, var(--ZI_popovers));
  48. position: fixed;
  49. min-width: 0;
  50. max-width: calc(100vw - 20px);
  51. box-shadow: var(--shadow);
  52. }
  53. .popover-default {
  54. &::after {
  55. content: "";
  56. position: absolute;
  57. top: -1px;
  58. bottom: -1px;
  59. left: -1px;
  60. right: -1px;
  61. z-index: -1px;
  62. box-shadow: var(--shadow);
  63. pointer-events: none;
  64. }
  65. border-radius: var(--roundness);
  66. border-color: var(--border);
  67. border-style: solid;
  68. border-width: 1px;
  69. background-color: var(--background);
  70. }
  71. .dropdown-menu {
  72. display: block;
  73. padding: 0;
  74. font-size: 1em;
  75. text-align: left;
  76. list-style: none;
  77. max-width: 100vw;
  78. z-index: var(--ZI_popover_override, var(--ZI_popovers));
  79. white-space: nowrap;
  80. background-color: var(--background);
  81. .dropdown-divider {
  82. height: 0;
  83. margin: 0.5rem 0;
  84. overflow: hidden;
  85. border-top: 1px solid var(--border);
  86. }
  87. .dropdown-item {
  88. border: none;
  89. &-icon {
  90. svg {
  91. width: var(--__line-height);
  92. margin-right: var(--__horizontal-gap);
  93. }
  94. }
  95. &.-has-submenu {
  96. .chevron-icon {
  97. margin-right: 0.25rem;
  98. margin-left: 2rem;
  99. }
  100. }
  101. .menu-checkbox {
  102. display: inline-block;
  103. vertical-align: middle;
  104. min-width: calc(var(--__line-height) + 1px);
  105. max-width: calc(var(--__line-height) + 1px);
  106. min-height: calc(var(--__line-height) + 1px);
  107. max-height: calc(var(--__line-height) + 1px);
  108. line-height: var(--__line-height);
  109. text-align: center;
  110. border-radius: 0;
  111. box-shadow: var(--shadow);
  112. margin-right: var(--__horizontal-gap);
  113. &.menu-checkbox-checked::after {
  114. font-size: 1.25em;
  115. content: "✓";
  116. }
  117. &.-radio {
  118. border-radius: 9999px;
  119. &.menu-checkbox-checked::after {
  120. font-size: 2em;
  121. content: "•";
  122. }
  123. }
  124. }
  125. }
  126. }
  127. </style>