Skip to content

A self-hosted media server and file management system

fix: video popover layers

aminnausince1dc07c65b0
diff --git a/resources/js/components/video/VideoPopover.vue b/resources/js/components/video/VideoPopover.vue
index 1f6eca58..35b7c527 100644
--- a/resources/js/components/video/VideoPopover.vue
+++ b/resources/js/components/video/VideoPopover.vue
@@ -2,6 +2,7 @@
import { nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch, type ComponentPublicInstance } from 'vue';
import { OnClickOutside } from '@vueuse/components';
import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';
+import { cn } from '@aminnausin/cedar-ui';
import VideoButton from './VideoButton.vue';
@@ -70,6 +71,11 @@ const adjustPopoverPosition = () => {
}
};
+const handleClickOutside = (event: PointerEvent) => {
+ if (popoverButton.value?.$el?.contains(event.target as Node)) return;
+ popoverOpen.value = false;
+};
+
const handleClose = () => {
popoverOpen.value = false;
};
@@ -106,7 +112,7 @@ onUnmounted(() => {
:class="[buttonClass, { 'text-primary': popoverOpen }]"
:disabled="disabled"
:title="title"
- @click="popoverOpen = true"
+ @click="popoverOpen = !popoverOpen"
>
<template #icon>
<slot name="buttonIcon">
@@ -131,26 +137,17 @@ onUnmounted(() => {
>
<UseFocusTrap
v-if="popoverOpen"
- :class="[
- popoverClass,
- `${popoverPosition === 'bottom' ? `top-8 ${verticalOffset ? `sm:top-${verticalOffset}` : 'sm:top-12'}` : `${verticalOffset ? `bottom-${verticalOffset}` : `bottom-12`}`}`, // This wont generate classes
- 'scrollbar-dark absolute right-2 z-10 w-75 max-w-lg overflow-clip',
- ]"
+ :class="
+ cn(
+ 'scrollbar-dark absolute right-2 z-10 w-75 max-w-lg overflow-clip rounded-md border border-neutral-700/10 bg-neutral-800/90 p-1 shadow-xs backdrop-blur-xs',
+ `${popoverPosition === 'bottom' ? `top-8 ${verticalOffset ? `sm:top-${verticalOffset}` : 'sm:top-12'}` : `${verticalOffset ? `bottom-${verticalOffset}` : `bottom-14`}`}`, // This wont generate classes
+ popoverClass,
+ )
+ "
ref="popover"
:options="{ allowOutsideClick: true }"
>
- <OnClickOutside
- @trigger.stop="
- (e: any) => {
- popoverOpen = false;
- }
- "
- @keydown.esc="popoverOpen = false"
- tabindex="-1"
- v-show="popoverOpen"
- v-cloak
- :class="'w-full rounded-md border border-neutral-700/10 bg-neutral-800/90 p-1 shadow-xs backdrop-blur-xs'"
- >
+ <OnClickOutside @trigger="handleClickOutside" @keydown.esc="popoverOpen = false" tabindex="-1" v-show="popoverOpen" v-cloak :class="'w-full'">
<div
v-show="popoverArrow && popoverPosition == 'bottom'"
ref="popoverArrowRef"
diff --git a/resources/js/components/video/VideoPopoverItem.vue b/resources/js/components/video/VideoPopoverItem.vue
index a5d8d07e..2ed97513 100644
--- a/resources/js/components/video/VideoPopoverItem.vue
+++ b/resources/js/components/video/VideoPopoverItem.vue
@@ -10,7 +10,8 @@ const props = withDefaults(defineProps<PopoverItem>(), {});
:title="title ?? 'Popover Item'"
:class="
cn(
- 'disabled:button-disabled transition-input relative flex w-full cursor-pointer items-center rounded-md px-2 py-1.5 text-xs outline-hidden ease-in-out select-none hover:bg-neutral-900',
+ 'disabled:button-disabled transition-input flex w-full cursor-pointer items-center rounded-md px-2 py-1.5 text-xs ease-in-out select-none',
+ 'hocus:bg-neutral-900 ring-white outline-hidden ring-inset focus-within:ring',
{ selectedStyle: selected },
{ hidden: disabled },
style,
diff --git a/resources/js/components/video/VideoPopoverSlider.vue b/resources/js/components/video/VideoPopoverSlider.vue
index d60d9234..be19fb8b 100644
--- a/resources/js/components/video/VideoPopoverSlider.vue
+++ b/resources/js/components/video/VideoPopoverSlider.vue
@@ -1,21 +1,38 @@
<script setup lang="ts">
import type { PopoverSlider } from '@/types/types';
+import { cn } from '@aminnausin/cedar-ui';
+
withDefaults(defineProps<PopoverSlider>(), { min: 10, max: 200, step: 5 });
const model = defineModel();
</script>
<template>
- <section
- :disabled="disabled"
+ <label
:title="title ?? 'Popover Slider'"
- :class="`relative flex w-full flex-wrap items-center gap-y-2 rounded-md px-2 py-1.5 text-xs outline-hidden transition-colors hover:bg-neutral-900 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 ${style ?? ''}`"
+ :class="
+ cn(
+ 'flex w-full flex-wrap items-center gap-y-2 rounded-md px-2 py-1.5 text-xs',
+ 'outline-hidden transition-colors focus-within:bg-neutral-900 hover:bg-neutral-900',
+ { 'button-disabled': disabled },
+ style,
+ )
+ "
@wheel="wheelAction"
v-show="!hidden"
>
<component v-if="icon" :is="icon" class="mr-2 size-4 shrink-0" />
<span class="text-nowrap">{{ text }}</span>
- <span class="ml-auto text-xs tracking-wide opacity-60">{{ shortcut ?? '' }}</span>
- <input type="range" @input="action" :min="min" :max="max" :step="step" v-model="model" :class="`slider volume h-2 w-full`" />
- </section>
+ <span class="text-foreground-1 dark ml-auto text-xs tracking-wide">{{ shortcut }}</span>
+ <input
+ type="range"
+ @input="action"
+ :min="min"
+ :max="max"
+ :step="step"
+ v-model="model"
+ :class="`slider volume h-2 w-full ring-white outline-hidden focus:ring`"
+ :disabled="disabled"
+ />
+ </label>
</template>