A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
Fix escape to close modal and select not working + add tab index to modals
aminnausin243f7de3ee12
diff --git a/package-lock.json b/package-lock.jsonindex 6a696700..3a7c42c8 100755--- a/package-lock.json+++ b/package-lock.json@@ -9,6 +9,8 @@"@tailwindcss/forms": "^0.5.7","@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0",+ "@vueuse/integrations": "^11.0.0",+ "focus-trap": "^7.5.4","lodash.clonedeep": "^4.5.0","lodash.isequal": "^4.5.0","pinia": "^2.1.7",@@ -1256,6 +1258,134 @@}}},+ "node_modules/@vueuse/integrations": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-11.0.0.tgz",+ "integrity": "sha512-B95nBX4B2q2ZETBDldrKARM/fYXBHfwdo44UbHBq4bUTi25lrlc8MwAZGqEoRvdV4ND9T6O1Rb9e4kaCJFXnqw==",+ "license": "MIT",+ "dependencies": {+ "@vueuse/core": "11.0.0",+ "@vueuse/shared": "11.0.0",+ "vue-demi": ">=0.14.10"+ },+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ },+ "peerDependencies": {+ "async-validator": "^4",+ "axios": "^1",+ "change-case": "^5",+ "drauu": "^0.4",+ "focus-trap": "^7",+ "fuse.js": "^7",+ "idb-keyval": "^6",+ "jwt-decode": "^4",+ "nprogress": "^0.2",+ "qrcode": "^1.5",+ "sortablejs": "^1",+ "universal-cookie": "^7"+ },+ "peerDependenciesMeta": {+ "async-validator": {+ "optional": true+ },+ "axios": {+ "optional": true+ },+ "change-case": {+ "optional": true+ },+ "drauu": {+ "optional": true+ },+ "focus-trap": {+ "optional": true+ },+ "fuse.js": {+ "optional": true+ },+ "idb-keyval": {+ "optional": true+ },+ "jwt-decode": {+ "optional": true+ },+ "nprogress": {+ "optional": true+ },+ "qrcode": {+ "optional": true+ },+ "sortablejs": {+ "optional": true+ },+ "universal-cookie": {+ "optional": true+ }+ }+ },+ "node_modules/@vueuse/integrations/node_modules/@vueuse/core": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-11.0.0.tgz",+ "integrity": "sha512-shibzNGjmRjZucEm97B8V0NO5J3vPHMCE/mltxQ3vHezbDoFQBMtK11XsfwfPionxSbo+buqPmsCljtYuXIBpw==",+ "license": "MIT",+ "dependencies": {+ "@types/web-bluetooth": "^0.0.20",+ "@vueuse/metadata": "11.0.0",+ "@vueuse/shared": "11.0.0",+ "vue-demi": ">=0.14.10"+ },+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ }+ },+ "node_modules/@vueuse/integrations/node_modules/@vueuse/metadata": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-11.0.0.tgz",+ "integrity": "sha512-0TKsAVT0iUOAPWyc9N79xWYfovJVPATiOPVKByG6jmAYdDiwvMVm9xXJ5hp4I8nZDxpCcYlLq/Rg9w1Z/jrGcg==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ }+ },+ "node_modules/@vueuse/integrations/node_modules/@vueuse/shared": {+ "version": "11.0.0",+ "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.0.0.tgz",+ "integrity": "sha512-i4ZmOrIEjSsL94uAEt3hz88UCz93fMyP/fba9S+vypX90fKg3uYX9cThqvWc9aXxuTzR0UGhOKOTQd//Goh1nQ==",+ "license": "MIT",+ "dependencies": {+ "vue-demi": ">=0.14.10"+ },+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ }+ },+ "node_modules/@vueuse/integrations/node_modules/vue-demi": {+ "version": "0.14.10",+ "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",+ "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "vue-demi-fix": "bin/vue-demi-fix.js",+ "vue-demi-switch": "bin/vue-demi-switch.js"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/antfu"+ },+ "peerDependencies": {+ "@vue/composition-api": "^1.0.0-rc.1",+ "vue": "^3.0.0-0 || ^2.6.0"+ },+ "peerDependenciesMeta": {+ "@vue/composition-api": {+ "optional": true+ }+ }+ },"node_modules/@vueuse/metadata": {"version": "10.11.0","resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.11.0.tgz",@@ -1565,7 +1695,7 @@"version": "0.4.0","resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz","integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",- "dev": true+ "devOptional": true},"node_modules/autoprefixer": {"version": "10.4.19",@@ -1608,7 +1738,7 @@"version": "1.7.4","resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz","integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"follow-redirects": "^1.15.6",@@ -1825,7 +1955,7 @@"version": "1.0.8","resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz","integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",- "dev": true,+ "devOptional": true,"dependencies": {"delayed-stream": "~1.0.0"},@@ -1909,7 +2039,7 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz","integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",- "dev": true,+ "devOptional": true,"engines": {"node": ">=0.4.0"}@@ -2434,11 +2564,20 @@"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==","dev": true},+ "node_modules/focus-trap": {+ "version": "7.5.4",+ "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz",+ "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==",+ "license": "MIT",+ "dependencies": {+ "tabbable": "^6.2.0"+ }+ },"node_modules/follow-redirects": {"version": "1.15.6","resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz","integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",- "dev": true,+ "devOptional": true,"funding": [{"type": "individual",@@ -2473,7 +2612,7 @@"version": "4.0.0","resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz","integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",- "dev": true,+ "devOptional": true,"dependencies": {"asynckit": "^0.4.0","combined-stream": "^1.0.8",@@ -3523,7 +3662,7 @@"version": "1.1.0","resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz","integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",- "dev": true+ "devOptional": true},"node_modules/punycode": {"version": "2.3.1",@@ -3948,6 +4087,12 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/tabbable": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",+ "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==",+ "license": "MIT"+ },"node_modules/tailwindcss": {"version": "3.4.1","resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz",diff --git a/package.json b/package.jsonindex 6751e74b..18e4a2dd 100755--- a/package.json+++ b/package.json@@ -28,6 +28,8 @@"@tailwindcss/forms": "^0.5.7","@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0",+ "@vueuse/integrations": "^11.0.0",+ "focus-trap": "^7.5.4","lodash.clonedeep": "^4.5.0","lodash.isequal": "^4.5.0","pinia": "^2.1.7",diff --git a/resources/js/components/inputs/FormInput.vue b/resources/js/components/inputs/FormInput.vueindex 4e3fa0c3..51c41da3 100755--- a/resources/js/components/inputs/FormInput.vue+++ b/resources/js/components/inputs/FormInput.vue@@ -5,12 +5,12 @@ const model = defineModel();<template><input- :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`"+ :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.vueindex 8595792c..bfe34506 100755--- a/resources/js/components/inputs/FormTextArea.vue+++ b/resources/js/components/inputs/FormTextArea.vue@@ -1,7 +1,7 @@<script setup>import { ref } from 'vue';-const { field } = defineProps(['field']);+const { field, tabindex } = defineProps(['field', 'tabindex']);const model = defineModel();const $el = ref(null)@@ -23,6 +23,7 @@ const resize = () => {:title="field.name":required="field.required":placeholder="field.placeholder ?? 'Type your message here. I will resize based on the height content.'"+ :tabindex="tabindex ?? 0"v-model="model"></textarea></div>diff --git a/resources/js/components/pinesUI/ButtonClipboard.vue b/resources/js/components/pinesUI/ButtonClipboard.vueindex 4181bdde..3fb1f2df 100755--- a/resources/js/components/pinesUI/ButtonClipboard.vue+++ b/resources/js/components/pinesUI/ButtonClipboard.vue@@ -1,7 +1,7 @@<script setup>import useClipboard from '../../composables/useClipboard';import ButtonIcon from '../inputs/ButtonIcon.vue'-const props = defineProps(['text']);+const props = defineProps(['text', 'tabindex']);const clipboard = useClipboard(props.text)</script>@@ -31,7 +31,7 @@ const clipboard = useClipboard(props.text)</div></div></Transition>- <ButtonIcon @click="clipboard.copyToClipboard();" class="flex items-center justify-center h-8 w-9 text-xs group text-neutral-500 hover:text-neutral-600 dark:text-gray-300 dark:hover:text-gray-400 hover:bg-neutral-100 focus:!ring-green-600/50">+ <ButtonIcon @click="clipboard.copyToClipboard();" :tabindex="props.tabindex ?? 1" class="flex items-center justify-center h-8 w-9 text-xs group text-neutral-500 hover:text-neutral-600 dark:text-gray-300 dark:hover:text-gray-400 hover:bg-neutral-100 focus:!ring-green-600/50"><template #icon><svg v-if="clipboard.copyNotification" class="w-4 h-4 text-green-500 stroke-current"xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"diff --git a/resources/js/components/pinesUI/InputSelect.vue b/resources/js/components/pinesUI/InputSelect.vueindex f0cf454a..60a06610 100755--- a/resources/js/components/pinesUI/InputSelect.vue+++ b/resources/js/components/pinesUI/InputSelect.vue@@ -69,7 +69,7 @@ watch(selectButton, () => { select.selectButton = selectButton; }, { immediate:watch(selectableItemsList, () => { select.selectableItemsList = selectableItemsList; }, { immediate: true })</script><template>- <div @keydown.escape="if (select.selectOpen) { select.toggleSelect(false); }"+ <div @keydown.esc="if (select.selectOpen) { select.toggleSelect(false); }"@keydown.down="if (select.selectOpen) { select.selectableItemActiveNext(); } else { select.toggleSelect(true); } event.preventDefault();"@keydown.up="if (select.selectOpen) { select.selectableItemActivePrevious(); } else { select.toggleSelect(true); } event.preventDefault();"@keydown.enter="select.selectedItem = select.selectableItemActive; select.toggleSelect(false);"diff --git a/resources/js/components/pinesUI/ModalBase.vue b/resources/js/components/pinesUI/ModalBase.vueindex 71207403..6b44ffaf 100755--- a/resources/js/components/pinesUI/ModalBase.vue+++ b/resources/js/components/pinesUI/ModalBase.vue@@ -1,7 +1,11 @@<script setup>+import { nextTick, ref, watch } from 'vue';import ButtonCorner from '../inputs/ButtonCorner.vue';+import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component';+import { OnClickOutside } from '@vueuse/components';+const modalRoot = ref(null);-defineProps({+const props = defineProps({modalData: {required: true},@@ -21,40 +25,51 @@ const submitModal = async (action, modalData) => {await action();modalData.toggleModal(false);}++watch(() => props.modalData.modalOpen, async (value) => {++ if(value && modalRoot.value !== null) {+ await nextTick();+ // modalRoot.value.focus();+ }+} )</script><template>- <div @keydown.escape="modalData.toggleModal(false)" :class="{ 'z-20': modalData.modalOpen }" class="relative w-auto h-auto">- <Teleport to="body">- <div v-show="modalData.modalOpen || modalData.isAnimating"- class="fixed top-0 left-0 z-[25] flex items-center justify-center w-full h-screen text-neutral-900 dark:text-neutral-200"- v-cloak>- <Transition enter-active-class="ease-out duration-300" enter-from-class="opacity-0" enter-to-class="opacity-100" leave-active-class="ease-in duration-300" leave-from-class="opacity-100" leave-to-class="opacity-0">- <div v-if="modalData.modalOpen" @click="modalData.toggleModal(false)" class="absolute inset-0 w-full h-full backdrop-blur-sm bg-opacity-70"></div>- </Transition>- <Transition enter-active-class="ease-out duration-300" enter-from-class="opacity-0 -translate-y-2 sm:scale-95" enter-to-class="opacity-100 translate-y-0 sm:scale-100" leave-active-class="ease-in duration-200" leave-from-class="opacity-100 translate-y-0 sm:scale-100" leave-to-class="opacity-0 -translate-y-2 sm:scale-95">- <div v-if="modalData.modalOpen" x-trap.inert.noscroll="modalOpen" class="relative w-full m-6 p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg rounded-md sm:rounded-lg">- <div class="flex items-center justify-between pb-3">- <h3 class="text-lg font-semibold">{{ modalData?.title ?? 'Modal Title' }}</h3>- <ButtonCorner @click="modalData.toggleModal(false)"/>- </div>- <slot name="content">- <div class="relative w-auto pb-8">- <p>This is placeholder text. Replace it with your own content.</p>- </div>- </slot>- <slot v-if="useControls" name="controls">- <div class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2">- <button @click="modalData.toggleModal(false)" type="button"- class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border dark:border-neutral-600 rounded-md focus:outline-none "- :class="'focus:ring-1 focus:ring-neutral-100 dark:focus:ring-neutral-400 focus:ring-offset-1 hover:bg-neutral-100 dark:hover:bg-neutral-900'">Cancel</button>- <button @click="submitModal(action, modalData)" type="button"- class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none "- :class="'focus:ring-1 focus:ring-violet-900 focus:ring-offset-1 bg-neutral-950 hover:bg-neutral-800 dark:hover:bg-neutral-900 '">{{ modalData.submitText }}</button>+ <Teleport to="body">+ <div v-show="modalData.modalOpen || modalData.isAnimating"+ class="fixed top-0 left-0 z-[25] flex items-center justify-center w-full h-screen text-neutral-900 dark:text-neutral-200"+ v-cloak>+ <Transition enter-active-class="ease-out duration-300" enter-from-class="opacity-0" enter-to-class="opacity-100" leave-active-class="ease-in duration-300" leave-from-class="opacity-100" leave-to-class="opacity-0">+ <div v-if="modalData.modalOpen" class="absolute inset-0 w-full h-full backdrop-blur-sm bg-opacity-70"></div>+ </Transition>+ <Transition enter-active-class="ease-out duration-300" enter-from-class="opacity-0 -translate-y-2 sm:scale-95" enter-to-class="opacity-100 translate-y-0 sm:scale-100" leave-active-class="ease-in duration-200" leave-from-class="opacity-100 translate-y-0 sm:scale-100" leave-to-class="opacity-0 -translate-y-2 sm:scale-95">+ <UseFocusTrap v-if="modalData.modalOpen" >+ <OnClickOutside @trigger="modalData.toggleModal(false)">+ <div class="relative w-full m-6 p-6 bg-white dark:bg-neutral-800/90 backdrop-blur-lg border shadow-lg border-neutral-200 dark:border-neutral-700 sm:max-w-lg rounded-md sm:rounded-lg"+ @keydown.esc="modalData.toggleModal(false)">+ <div class="flex items-center justify-between pb-3">+ <h3 class="text-lg font-semibold">{{ modalData?.title ?? 'Modal Title' }}</h3>+ <ButtonCorner @click="modalData.toggleModal(false)" tabindex="99"/></div>- </slot>- </div>- </Transition>- </div>- </Teleport>- </div>+ <slot name="content">+ <div class="relative w-auto pb-8">+ <p>This is placeholder text. Replace it with your own content.</p>+ </div>+ </slot>+ <slot v-if="useControls" name="controls">+ <div class="relative flex flex-col-reverse sm:flex-row sm:justify-end gap-2">+ <button @click="modalData.toggleModal(false)" type="button" tabindex="97"+ class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border dark:border-neutral-600 rounded-md focus:outline-none "+ :class="'focus:ring-1 focus:ring-neutral-100 dark:focus:ring-neutral-400 focus:ring-offset-1 hover:bg-neutral-100 dark:hover:bg-neutral-900'">Cancel</button>+ <button @click="submitModal(action, modalData)" type="button" tabindex="98"+ class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none "+ :class="'focus:ring-1 focus:ring-violet-900 focus:ring-offset-1 bg-neutral-950 hover:bg-neutral-800 dark:hover:bg-neutral-900 '">{{ modalData.submitText }}</button>+ </div>+ </slot>+ </div>+ </OnClickOutside>+ </UseFocusTrap>+ </Transition>+ </div>+ </Teleport></template>\ No newline at end of file