Skip to content

A self-hosted media server and file management system

standardise form inputs

aminnausinf0f66e924ba1
diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vue
index d48c23d3..8e50079d 100644
--- a/resources/js/components/cards/VideoCard.vue
+++ b/resources/js/components/cards/VideoCard.vue
@@ -6,30 +6,30 @@ import { watch } from 'vue';
const props = defineProps(['video', 'index', 'currentID']);
-const metaData = useMetaData(props.video.attributes);
+const metaData = useMetaData(props.video?.attributes);
const emit = defineEmits(['playByID']);
const handlePlay = () => {
- emit('playByID', props.video.id);
+ emit('playByID', props.video?.id);
}
const handlePropsUpdate = () => {
- metaData.updateData(props.video.attributes);
+ metaData.updateData(props.video?.attributes);
}
watch(props, handlePropsUpdate, {immediate: true});
</script>
<template>
- <tr :class="{ 'ring-violet-600/70 ring-[0.125rem]': (props.currentID === props.video.id) }"
+ <tr :class="{ 'ring-violet-600/70 ring-[0.125rem]': (props.currentID === props.video?.id) }"
class="shadow vid-row w-full rounded-md dark:bg-neutral-800 dark:hover:bg-indigo-900 bg-gray-100 hover:bg-violet-300 odd:bg-violet-100 hover:odd:bg-violet-300 dark:odd:bg-zinc-700 dark:hover:odd:bg-indigo-900 p-3 flex ring-inset flex-wrap flex-col sm:flex-row sm:flex-nowrap"
- :data-id="props.video.id" :data-path="`../${props.video.attributes.path}`" @click="handlePlay">
+ :data-id="props.video?.id" :data-path="`../${props.video?.attributes.path}`" @click="handlePlay">
<td class="flex gap-12 w-full">
- <p class="vid-row-title w-full xl:min-w-48 sm:max-w-1/2 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Title: </span><span class="line-clamp-1">{{ metaData?.fields.title }}</span></p>
- <p class="vid-row-duration truncate hidden sm:block">{{ metaData?.fields.duration }}</p>
+ <p class="vid-row-title w-full xl:min-w-48 sm:max-w-1/2 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Title: </span><span class="line-clamp-1">{{ metaData?.fields?.title }}</span></p>
+ <p class="vid-row-duration truncate hidden sm:block">{{ metaData?.fields?.duration }}</p>
</td>
<td class="flex gap-12 w-full sm:justify-end">
- <p class="vid-row-title truncate hidden sm:block">{{ metaData?.fields.views }}</p>
- <p class="vid-row-date w-full xl:min-w-36 sm:max-w-1/3 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Date: </span><span class="line-clamp-1">{{ toFormattedDate(new Date(props.video.attributes.date + ' GMT')) }}</span></p>
+ <p class="vid-row-title truncate hidden sm:block">{{ metaData?.fields?.views }}</p>
+ <p class="vid-row-date w-full xl:min-w-36 sm:max-w-1/3 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Date: </span><span class="line-clamp-1">{{ toFormattedDate(new Date(props.video?.attributes.date + ' GMT')) }}</span></p>
</td>
</tr>
</template>
\ No newline at end of file
diff --git a/resources/js/components/inputs/FormInput.vue b/resources/js/components/inputs/FormInput.vue
index 2a6b22fa..64612509 100644
--- a/resources/js/components/inputs/FormInput.vue
+++ b/resources/js/components/inputs/FormInput.vue
@@ -5,7 +5,12 @@
<template>
<input
- class="border-gray-300 dark:border-gray-600 dark:text-gray-300 dark:bg-input-900 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm block mt-1 w-full"
+ :class="`rounded-md shadow-sm block mt-1 w-full
+ focus:outline-none border-none
+ disabled:cursor-not-allowed disabled:opacity-50
+ text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-700 placeholder:text-neutral-400
+ ring-inset focus:ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700
+ focus:ring-[0.125rem] focus:ring-indigo-400 dark:focus:ring-indigo-500`"
:name="field.name"
:title="field.name"
:type="field.type"
diff --git a/resources/js/components/inputs/FormTextArea.vue b/resources/js/components/inputs/FormTextArea.vue
index b8bab023..8595792c 100644
--- a/resources/js/components/inputs/FormTextArea.vue
+++ b/resources/js/components/inputs/FormTextArea.vue
@@ -14,7 +14,11 @@ const resize = () => {
<template>
<div class="block mt-1 w-full">
<textarea @input="resize()" type="text" ref="$el"
- class="flex w-full h-auto min-h-[80px] px-3 py-2 text-sm border rounded-md bg-white border-gray-300 dark:border-gray-600 dark:text-gray-300 dark:bg-input-900 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"
+ :class="`flex w-full h-auto min-h-[80px] px-3 py-2 text-sm rounded-md focus:outline-none border-none
+ disabled:cursor-not-allowed disabled:opacity-50
+ text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-700 placeholder:text-neutral-400
+ ring-inset focus:ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700
+ focus:ring-[0.125rem] focus:ring-indigo-400 dark:focus:ring-indigo-500`"
:name="field.name"
:title="field.name"
:required="field.required"
diff --git a/resources/js/components/inputs/LabelledTextInput.vue b/resources/js/components/inputs/LabelledTextInput.vue
index 85e49bdc..0806176f 100644
--- a/resources/js/components/inputs/LabelledTextInput.vue
+++ b/resources/js/components/inputs/LabelledTextInput.vue
@@ -8,6 +8,13 @@ const { text, placeholder, id } = defineProps(['text', 'placeholder', 'id'])
<div class="flex flex-col justify-center gap-2 text-sm">
<FormInputLabel :field="{name: id, text}"/>
<input type="text" v-model="model" :name="id" :id="id" :placeholder="placeholder"
- class="h-10 p-2 shadow-sm rounded-md w-full focus:border-none focus:ring-2 focus:ring-indigo-400 dark:focus:ring-indigo-500 text-gray-900 dark:text-neutral-100 border-neutral-200/70 bg-white dark:bg-neutral-800 text-sm">
+ :class="`h-10 p-2 shadow-sm rounded-md w-full text-sm
+ border-none outline-none
+ disabled:cursor-not-allowed disabled:opacity-50
+ text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-800 placeholder:text-neutral-400
+ ring-inset focus:ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700
+ hocus:ring-[0.125rem] focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700`"
+ >
+
</div>
</template>
\ No newline at end of file
diff --git a/resources/js/components/labels/FormInputLabel.vue b/resources/js/components/labels/FormInputLabel.vue
index 9dcd1164..6a15c732 100644
--- a/resources/js/components/labels/FormInputLabel.vue
+++ b/resources/js/components/labels/FormInputLabel.vue
@@ -3,7 +3,7 @@
</script>
<template>
- <label class="block font-medium text-gray-700 dark:text-gray-300" :for="field?.name" :class="{textSize : textSize, 'text-sm': !textSize}">
+ <label class="block font-medium text-gray-700 dark:text-neutral-200" :for="field?.name" :class="{textSize : textSize, 'text-sm': !textSize}">
{{ field?.text }}
</label>
<p v-if="field?.subtext" class="text-sm/6 text-gray-500 dark:text-gray-400">{{ field.subtext }}</p>
diff --git a/resources/js/components/pinesUI/DropdownMenu.vue b/resources/js/components/pinesUI/DropdownMenu.vue
index f24b2b82..13590fe3 100644
--- a/resources/js/components/pinesUI/DropdownMenu.vue
+++ b/resources/js/components/pinesUI/DropdownMenu.vue
@@ -1,12 +1,17 @@
+<script setup>
+import { ref } from 'vue';
+import { OnClickOutside } from '@vueuse/components'
+
+const dropdownOpen = ref(false)
+</script>
+
<template>
- <div x-data="{
- dropdownOpen: false
- }" class="relative">
+ <div class="relative">
<button @click="dropdownOpen = true"
- class="inline-flex items-center justify-center h-12 py-2 pl-3 pr-12 text-sm font-medium transition-colors bg-white border rounded-md text-neutral-700 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none disabled:opacity-50 disabled:pointer-events-none">
+ class="inline-flex items-center justify-center h-12 py-2 pl-3 pr-12 text-sm font-medium transition-colors border rounded-md text-neutral-700 dark:text-neutral-100 hover:bg-neutral-100 bg-white dark:bg-neutral-800 focus:outline-none disabled:opacity-50 disabled:pointer-events-none">
<img src="https://cdn.devdojo.com/images/may2023/adam.jpeg"
- class="object-cover w-8 h-8 border rounded-full border-neutral-200" />
+ class="object-cover w-8 h-8 border rounded-full border-neutral-200 dark:border-neutral-500" />
<span class="flex flex-col items-start flex-shrink-0 h-full ml-2 leading-none translate-y-px">
<span>Adam Wathan</span>
<span class="text-xs font-light text-neutral-400">@adamwathan</span>
@@ -18,197 +23,204 @@
</svg>
</button>
- <div x-show="dropdownOpen" @click.away="dropdownOpen = false" x-transition:enter="ease-out duration-200"
- x-transition:enter-start="-translate-y-2" x-transition:enter-end="translate-y-0"
- class="absolute top-0 z-50 w-56 mt-12 -translate-x-1/2 left-1/2" x-cloak>
- <div class="p-1 mt-1 bg-white border rounded-md shadow-md border-neutral-200/70 text-neutral-700">
- <div class="px-2 py-1.5 text-sm font-semibold">My Account</div>
- <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path>
- <circle cx="12" cy="7" r="4"></circle>
- </svg>
- <span>Profile</span>
- <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘P</span>
- </a>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <rect width="20" height="14" x="2" y="5" rx="2"></rect>
- <line x1="2" x2="22" y1="10" y2="10"></line>
- </svg>
- <span>Billing</span><span class="ml-auto text-xs tracking-widest opacity-60">⌘B</span>
- </a>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path
- d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z">
- </path>
- <circle cx="12" cy="12" r="3"></circle>
- </svg>
- <span>Settings</span>
- <span class="ml-auto text-xs tracking-widest opacity-60">⌘S</span>
- </a>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <rect width="20" height="16" x="2" y="4" rx="2" ry="2"></rect>
- <path d="M6 8h.001"></path>
- <path d="M10 8h.001"></path>
- <path d="M14 8h.001"></path>
- <path d="M18 8h.001"></path>
- <path d="M8 12h.001"></path>
- <path d="M12 12h.001"></path>
- <path d="M16 12h.001"></path>
- <path d="M7 16h10"></path>
- </svg>
- <span>Keyboard shortcuts</span>
- <span class="ml-auto text-xs tracking-widest opacity-60">⌘K</span>
- </a>
- <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
- <div
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
- <circle cx="9" cy="7" r="4"></circle>
- <path d="M22 21v-2a4 4 0 0 0-3-3.87"></path>
- <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
- </svg>
- <span>Team</span>
- </div>
- <div class="relative group">
- <div
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
- <circle cx="9" cy="7" r="4"></circle>
- <line x1="19" x2="19" y1="8" y2="14"></line>
- <line x1="22" x2="16" y1="11" y2="11"></line>
- </svg>
- <span>Invite users</span>
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 ml-auto">
- <polyline points="9 18 15 12 9 6"></polyline>
- </svg>
- </div>
- <div data-submenu
- class="absolute top-0 right-0 invisible mr-1 duration-200 ease-out translate-x-full opacity-0 group-hover:mr-0 group-hover:visible group-hover:opacity-100">
+ <OnClickOutside @trigger="dropdownOpen = false">
+ <Transition
+ enter-active-class="ease-out duration-200"
+ enter-from-class="-translate-y-2"
+ enter-to-class="translate-y-0"
+ >
+ <div v-if="dropdownOpen"
+ class="absolute top-0 z-50 w-56 mt-12 -translate-x-1/2 left-1/2" v-cloak>
+ <div class="p-1 mt-1 bg-white dark:bg-neutral-800 border rounded-md shadow-md border-neutral-200/70 dark:border-neutral-700 text-neutral-700 dark:text-neutral-100">
+ <div class="px-2 py-1.5 text-sm font-semibold">My Account</div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path>
+ <circle cx="12" cy="7" r="4"></circle>
+ </svg>
+ <span>Profile</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘P</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <rect width="20" height="14" x="2" y="5" rx="2"></rect>
+ <line x1="2" x2="22" y1="10" y2="10"></line>
+ </svg>
+ <span>Billing</span><span class="ml-auto text-xs tracking-widest opacity-60">⌘B</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path
+ d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z">
+ </path>
+ <circle cx="12" cy="12" r="3"></circle>
+ </svg>
+ <span>Settings</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘S</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <rect width="20" height="16" x="2" y="4" rx="2" ry="2"></rect>
+ <path d="M6 8h.001"></path>
+ <path d="M10 8h.001"></path>
+ <path d="M14 8h.001"></path>
+ <path d="M18 8h.001"></path>
+ <path d="M8 12h.001"></path>
+ <path d="M12 12h.001"></path>
+ <path d="M16 12h.001"></path>
+ <path d="M7 16h10"></path>
+ </svg>
+ <span>Keyboard shortcuts</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘K</span>
+ </a>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
<div
- class="z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white p-1 shadow-md animate-in slide-in-from-left-1 w-40">
- <div @click="dropdownOpen = false"
- class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
+ <circle cx="9" cy="7" r="4"></circle>
+ <path d="M22 21v-2a4 4 0 0 0-3-3.87"></path>
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
+ </svg>
+ <span>Team</span>
+ </div>
+ <div class="relative group">
+ <div
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
- stroke-linejoin="round">
- <rect width="20" height="16" x="2" y="4" rx="2"></rect>
- <path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path>
+ <circle cx="9" cy="7" r="4"></circle>
+ <line x1="19" x2="19" y1="8" y2="14"></line>
+ <line x1="22" x2="16" y1="11" y2="11"></line>
</svg>
- <span>Email</span>
- </div>
- <div @click="dropdownOpen = false"
- class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ <span>Invite users</span>
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
- stroke-linejoin="round">
- <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
+ stroke-linejoin="round" class="w-4 h-4 ml-auto">
+ <polyline points="9 18 15 12 9 6"></polyline>
</svg>
- <span>Message</span>
</div>
- <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
- <div @click="dropdownOpen = false"
- class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
- fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
- stroke-linejoin="round">
- <circle cx="12" cy="12" r="10"></circle>
- <line x1="12" x2="12" y1="8" y2="16"></line>
- <line x1="8" x2="16" y1="12" y2="12"></line>
- </svg>
- <span>More...</span>
+ <div data-submenu
+ class="absolute top-0 right-0 invisible mr-1 duration-200 ease-out translate-x-full opacity-0 group-hover:mr-0 group-hover:visible group-hover:opacity-100">
+ <div
+ class="z-50 min-w-[8rem] overflow-hidden rounded-md border bg-white p-1 shadow-md animate-in slide-in-from-left-1 w-40">
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 dark:hover:bg-neutral-900 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <rect width="20" height="16" x="2" y="4" rx="2"></rect>
+ <path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path>
+ </svg>
+ <span>Email</span>
+ </div>
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 dark:hover:bg-neutral-900 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z">
+ </path>
+ </svg>
+ <span>Message</span>
+ </div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <div @click="dropdownOpen = false"
+ class="relative flex cursor-default select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 dark:hover:bg-neutral-900 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg class="w-4 h-4 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round">
+ <circle cx="12" cy="12" r="10"></circle>
+ <line x1="12" x2="12" y1="8" y2="16"></line>
+ <line x1="8" x2="16" y1="12" y2="12"></line>
+ </svg>
+ <span>More...</span>
+ </div>
+ </div>
</div>
</div>
+ <div
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <line x1="12" x2="12" y1="5" y2="19"></line>
+ <line x1="5" x2="19" y1="12" y2="12"></line>
+ </svg>
+ <span>New Team</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⌘+T</span>
+ </div>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path
+ d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4">
+ </path>
+ <path d="M9 18c-4.51 2-5-2-7-2"></path>
+ </svg>
+ <span>GitHub</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <circle cx="12" cy="12" r="10"></circle>
+ <circle cx="12" cy="12" r="4"></circle>
+ <line x1="4.93" x2="9.17" y1="4.93" y2="9.17"></line>
+ <line x1="14.83" x2="19.07" y1="14.83" y2="19.07"></line>
+ <line x1="14.83" x2="19.07" y1="9.17" y2="4.93"></line>
+ <line x1="14.83" x2="18.36" y1="9.17" y2="5.64"></line>
+ <line x1="4.93" x2="9.17" y1="19.07" y2="14.83"></line>
+ </svg>
+ <span>Support</span>
+ </a>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
+ data-disabled>
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path>
+ </svg>
+ <span>API</span>
+ </a>
+ <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
+ <a href="#_"
+ class="relative flex cursor-default select-none hover:bg-neutral-100 dark:hover:bg-neutral-900 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
+ fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
+ stroke-linejoin="round" class="w-4 h-4 mr-2">
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
+ <polyline points="16 17 21 12 16 7"></polyline>
+ <line x1="21" x2="9" y1="12" y2="12"></line>
+ </svg>
+ <span>Log out</span>
+ <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘Q</span>
+ </a>
</div>
</div>
- <div
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <line x1="12" x2="12" y1="5" y2="19"></line>
- <line x1="5" x2="19" y1="12" y2="12"></line>
- </svg>
- <span>New Team</span>
- <span class="ml-auto text-xs tracking-widest opacity-60">⌘+T</span>
- </div>
- <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path
- d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4">
- </path>
- <path d="M9 18c-4.51 2-5-2-7-2"></path>
- </svg>
- <span>GitHub</span>
- </a>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <circle cx="12" cy="12" r="10"></circle>
- <circle cx="12" cy="12" r="4"></circle>
- <line x1="4.93" x2="9.17" y1="4.93" y2="9.17"></line>
- <line x1="14.83" x2="19.07" y1="14.83" y2="19.07"></line>
- <line x1="14.83" x2="19.07" y1="9.17" y2="4.93"></line>
- <line x1="14.83" x2="18.36" y1="9.17" y2="5.64"></line>
- <line x1="4.93" x2="9.17" y1="19.07" y2="14.83"></line>
- </svg>
- <span>Support</span>
- </a>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"
- data-disabled>
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"></path>
- </svg>
- <span>API</span>
- </a>
- <div class="h-px my-1 -mx-1 bg-neutral-200"></div>
- <a href="#_"
- class="relative flex cursor-default select-none hover:bg-neutral-100 items-center rounded px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50">
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
- stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
- class="w-4 h-4 mr-2">
- <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
- <polyline points="16 17 21 12 16 7"></polyline>
- <line x1="21" x2="9" y1="12" y2="12"></line>
- </svg>
- <span>Log out</span>
- <span class="ml-auto text-xs tracking-widest opacity-60">⇧⌘Q</span>
- </a>
- </div>
- </div>
+ </Transition>
+ </OnClickOutside>
</div>
-
</template>
\ No newline at end of file
diff --git a/resources/js/components/pinesUI/InputSelect.vue b/resources/js/components/pinesUI/InputSelect.vue
index a8ee009f..de2b07c2 100644
--- a/resources/js/components/pinesUI/InputSelect.vue
+++ b/resources/js/components/pinesUI/InputSelect.vue
@@ -56,14 +56,16 @@ const selectButton = ref(null);
const selectableItemsList = ref(null);
const select = useSelect(props.options, { selectableItemsList, selectButton });
-const handleItemClick = (item) => {
- select.selectedItem = item; select.toggleSelect(false); selectButton.value?.focus();
+const handleItemClick = (item, setFocus = true) => {
+ select.selectedItem = item;
+ select.toggleSelect(false);
+ if(setFocus) selectButton.value?.focus();
emit('selectItem', select.selectedItem);
}
onMounted(() => {
if(props.defaultItem != undefined && props.defaultItem < props.options.length && props.defaultItem >=0){
- handleItemClick(props.options[props.defaultItem]);
+ handleItemClick(props.options[props.defaultItem], false);
}
})
@@ -79,8 +81,8 @@ watch(selectableItemsList, () => { select.selectableItemsList = selectableItemsL
<OnClickOutside @trigger="select.toggleSelect(false);">
<button ref="selectButton" @click="select.toggleSelect();"
- :class="{ 'focus:ring-2 focus:ring-indigo-400': !select.selectOpen }"
- class="relative h-10 flex items-center justify-between w-full py-2 pl-3 pr-10 text-left border rounded-md shadow-sm cursor-default focus:outline-none text-sm bg-white dark:bg-neutral-800 border-neutral-200/70">
+ :class="{ 'hocus:ring-0': select.selectOpen }"
+ class="relative h-10 flex items-center justify-between w-full py-2 pl-3 pr-10 text-left rounded-md shadow-sm cursor-default text-sm border-none focus:outline-none ring-inset ring-[1px] ring-neutral-200 dark:ring-neutral-700 hocus:ring-[0.125rem] hover:ring-violet-400 hover:dark:ring-violet-700 focus:ring-indigo-400 dark:focus:ring-indigo-500 text-gray-900 dark:text-neutral-100 bg-white dark:bg-neutral-800">
<span class="truncate">{{ select.selectedItem ? select.selectedItem.title : placeholder }}</span>
<span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"
diff --git a/tailwind.config.js b/tailwind.config.js
index 998d04cd..ed9edf1e 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,5 +1,8 @@
import defaultTheme from 'tailwindcss/defaultTheme';
+// eslint-disable-next-line no-undef
+const plugin = require('tailwindcss/plugin')
+
/** @type {import('tailwindcss').Config} */
export default {
prefix: '',
@@ -75,6 +78,9 @@ export default {
},
},
plugins: [
+ plugin(function({ addVariant }) {
+ addVariant('hocus', ['&:hover', '&:focus'])
+ }),
// eslint-disable-next-line no-undef
require('@tailwindcss/forms'),
// eslint-disable-next-line no-undef