@innertia-solutions/nuxt-theme-spark 0.1.96 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Admin/Base.vue +82 -34
- package/package.json +1 -1
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
floating?: boolean
|
|
4
|
+
user?: { name?: string; email?: string } | null
|
|
5
|
+
}>()
|
|
6
|
+
|
|
7
|
+
const emit = defineEmits<{ logout: [] }>()
|
|
8
|
+
|
|
2
9
|
const isOpen = ref(false)
|
|
3
|
-
const open
|
|
10
|
+
const open = () => { isOpen.value = true }
|
|
4
11
|
const close = () => { isOpen.value = false }
|
|
5
12
|
|
|
6
13
|
provide('vantage:sidebar', { isOpen, open, close })
|
|
14
|
+
|
|
15
|
+
const userInitial = computed(() =>
|
|
16
|
+
props.user?.name?.charAt(0).toUpperCase() ?? props.user?.email?.charAt(0).toUpperCase() ?? 'U'
|
|
17
|
+
)
|
|
7
18
|
</script>
|
|
8
19
|
|
|
9
20
|
<template>
|
|
10
|
-
<div class="bg-slate-50 dark:bg-slate-
|
|
21
|
+
<div class="bg-slate-50 dark:bg-slate-950 min-h-screen">
|
|
11
22
|
|
|
12
|
-
<!--
|
|
13
|
-
<Transition
|
|
14
|
-
|
|
23
|
+
<!-- Mobile backdrop -->
|
|
24
|
+
<Transition
|
|
25
|
+
enter-from-class="opacity-0" enter-active-class="transition-opacity duration-300"
|
|
26
|
+
leave-to-class="opacity-0" leave-active-class="transition-opacity duration-300"
|
|
27
|
+
>
|
|
15
28
|
<div v-if="isOpen" class="lg:hidden fixed inset-0 z-50 bg-black/40 backdrop-blur-sm" @click="close" />
|
|
16
29
|
</Transition>
|
|
17
30
|
|
|
@@ -20,46 +33,81 @@ provide('vantage:sidebar', { isOpen, open, close })
|
|
|
20
33
|
tabindex="-1"
|
|
21
34
|
aria-label="Sidebar"
|
|
22
35
|
:class="[
|
|
23
|
-
'fixed inset-y-0 start-0 z-60 w-65
|
|
24
|
-
'
|
|
25
|
-
'transition-transform duration-300',
|
|
26
|
-
'lg:translate-x-0',
|
|
36
|
+
'fixed inset-y-0 start-0 z-60 w-65',
|
|
37
|
+
'transition-transform duration-300 lg:translate-x-0',
|
|
27
38
|
isOpen ? 'translate-x-0' : 'max-lg:-translate-x-full',
|
|
39
|
+
floating ? 'p-3' : '',
|
|
28
40
|
]"
|
|
29
41
|
>
|
|
30
|
-
<div
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<line x1="21" x2="11" y1="12" y2="12" />
|
|
43
|
-
<line x1="21" x2="11" y1="6" y2="6" />
|
|
44
|
-
<line x1="21" x2="11" y1="18" y2="18" />
|
|
45
|
-
</svg>
|
|
46
|
-
</button>
|
|
42
|
+
<div
|
|
43
|
+
:class="[
|
|
44
|
+
'flex flex-col h-full',
|
|
45
|
+
floating
|
|
46
|
+
? 'bg-white dark:bg-slate-800 rounded-2xl border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden'
|
|
47
|
+
: 'bg-white dark:bg-slate-800 border-e border-slate-200 dark:border-slate-700',
|
|
48
|
+
]"
|
|
49
|
+
>
|
|
50
|
+
<!-- Logo + mobile close -->
|
|
51
|
+
<header class="flex items-center gap-x-1 px-3 pt-4 pb-2 shrink-0">
|
|
52
|
+
<div class="flex-1 min-w-0">
|
|
53
|
+
<slot name="logo" />
|
|
47
54
|
</div>
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
class="lg:hidden size-7 inline-flex justify-center items-center rounded-lg text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors"
|
|
58
|
+
@click="close"
|
|
59
|
+
>
|
|
60
|
+
<svg class="size-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
61
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
62
|
+
</svg>
|
|
63
|
+
</button>
|
|
48
64
|
</header>
|
|
49
65
|
|
|
50
|
-
<!--
|
|
51
|
-
<div class="
|
|
52
|
-
|
|
66
|
+
<!-- Search -->
|
|
67
|
+
<div v-if="$slots.search" class="px-3 pb-2 shrink-0">
|
|
68
|
+
<slot name="search" />
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<!-- Nav menu (scrollable) -->
|
|
72
|
+
<div class="flex-1 min-h-0 overflow-y-auto
|
|
73
|
+
[&::-webkit-scrollbar]:w-1.5
|
|
53
74
|
[&::-webkit-scrollbar-thumb]:rounded-full
|
|
54
|
-
[&::-webkit-scrollbar-track]:bg-
|
|
55
|
-
[&::-webkit-scrollbar-thumb]:bg-slate-
|
|
56
|
-
dark:[&::-webkit-scrollbar-
|
|
57
|
-
dark:[&::-webkit-scrollbar-thumb]:bg-slate-500">
|
|
75
|
+
[&::-webkit-scrollbar-track]:bg-transparent
|
|
76
|
+
[&::-webkit-scrollbar-thumb]:bg-slate-200
|
|
77
|
+
dark:[&::-webkit-scrollbar-thumb]:bg-slate-600">
|
|
58
78
|
<slot name="menu" />
|
|
59
79
|
</div>
|
|
60
80
|
|
|
61
81
|
<!-- User footer -->
|
|
62
|
-
<div class="shrink-0 border-t border-slate-
|
|
82
|
+
<div class="shrink-0 border-t border-slate-100 dark:border-slate-700/60 px-3 py-3 space-y-2">
|
|
83
|
+
|
|
84
|
+
<!-- User info + logout -->
|
|
85
|
+
<div v-if="user" class="flex items-center gap-x-2.5 px-1">
|
|
86
|
+
<div class="size-8 rounded-lg bg-blue-600 flex items-center justify-center text-white text-xs font-bold shrink-0 select-none">
|
|
87
|
+
{{ userInitial }}
|
|
88
|
+
</div>
|
|
89
|
+
<div class="flex-1 min-w-0">
|
|
90
|
+
<p class="text-xs font-semibold text-slate-700 dark:text-slate-200 truncate">{{ user.name ?? user.email }}</p>
|
|
91
|
+
<p v-if="user.name && user.email" class="text-[10px] text-slate-400 dark:text-slate-500 truncate">{{ user.email }}</p>
|
|
92
|
+
</div>
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
class="size-7 inline-flex items-center justify-center rounded-lg text-slate-400 hover:text-slate-600 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors shrink-0"
|
|
96
|
+
title="Cerrar sesión"
|
|
97
|
+
@click="emit('logout')"
|
|
98
|
+
>
|
|
99
|
+
<svg class="size-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
|
|
100
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M18 9l3 3m0 0l-3 3m3-3H9" />
|
|
101
|
+
</svg>
|
|
102
|
+
</button>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<!-- Controls slot (dark mode, notifications, etc.) -->
|
|
106
|
+
<div v-if="$slots['user-controls']" class="flex items-center gap-x-1.5">
|
|
107
|
+
<slot name="user-controls" />
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<!-- Env / extra slot -->
|
|
63
111
|
<slot name="user-footer" />
|
|
64
112
|
</div>
|
|
65
113
|
|