@fy-/fws-vue 0.0.7 → 0.0.8
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/ui/DefaultSidebar.vue +139 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/types.d.ts +8 -0
- package/components.d.ts +0 -22
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { NavLink } from "../../types";
|
|
3
|
+
import { ArrowRightIcon, ArrowLeftIcon } from "@heroicons/vue/24/solid";
|
|
4
|
+
import { useStorage } from "@vueuse/core";
|
|
5
|
+
import { useRoute } from "vue-router";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
links: NavLink[];
|
|
10
|
+
id?: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
id: "main",
|
|
15
|
+
baseUrl: "/",
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
const route = useRoute();
|
|
19
|
+
const isLinkActive = (link: NavLink) => {
|
|
20
|
+
if (link.to != props.baseUrl) {
|
|
21
|
+
if (route.path == link.to || route.path.includes(link.to))
|
|
22
|
+
return "fvside-active";
|
|
23
|
+
} else {
|
|
24
|
+
if (route.path == link.to) {
|
|
25
|
+
return "fvside-active";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
};
|
|
30
|
+
const isOpen = useStorage(`isOpenSidebar-${props.id}`, true);
|
|
31
|
+
</script>
|
|
32
|
+
<template>
|
|
33
|
+
<aside class="fui-sidebar" :class="isOpen ? '' : 'fui-sidebar__md'">
|
|
34
|
+
<div class="fui-sidebar__controller">
|
|
35
|
+
<button
|
|
36
|
+
class="btn neutral defaults"
|
|
37
|
+
aria-controls="side-nav"
|
|
38
|
+
@click="isOpen = !isOpen"
|
|
39
|
+
>
|
|
40
|
+
<ArrowLeftIcon v-if="isOpen" />
|
|
41
|
+
<ArrowRightIcon v-else />
|
|
42
|
+
<span class="sr-only">{{ $t("sidebar_size_control") }}</span>
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
<slot name="before"></slot>
|
|
46
|
+
<ul role="list" id="side-nav">
|
|
47
|
+
<li v-for="(link, index) of links" :key="`aside_link_${index}`">
|
|
48
|
+
<RouterLink
|
|
49
|
+
:to="link.to"
|
|
50
|
+
class="fui-sidebar__link"
|
|
51
|
+
:class="isLinkActive(link)"
|
|
52
|
+
>
|
|
53
|
+
<div role="tooltip" class="fui-tooltip">
|
|
54
|
+
{{ link.name }}
|
|
55
|
+
</div>
|
|
56
|
+
<component :is="link.icon" v-if="link.icon" />
|
|
57
|
+
<span>{{ link.name }}</span>
|
|
58
|
+
<span class="sr-only">{{ link.name }}</span>
|
|
59
|
+
</RouterLink>
|
|
60
|
+
</li>
|
|
61
|
+
<slot name="lis"></slot>
|
|
62
|
+
</ul>
|
|
63
|
+
<slot name="after"></slot>
|
|
64
|
+
</aside>
|
|
65
|
+
</template>
|
|
66
|
+
<style lang="scss" scoped>
|
|
67
|
+
.fui-sidebar {
|
|
68
|
+
@apply w-60;
|
|
69
|
+
transition: width 600ms ease-in-out;
|
|
70
|
+
.fui-sidebar__controller {
|
|
71
|
+
@apply py-3 flex items-center justify-end pr-3;
|
|
72
|
+
svg {
|
|
73
|
+
@apply w-4 h-4;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.fui-sidebar__link {
|
|
77
|
+
@apply relative flex w-full items-center py-3 px-3 font-semibold text-sm border-l-[.4rem] border-l-transparent;
|
|
78
|
+
@apply text-fv-neutral-600 hover:bg-fv-neutral-200/[.3] focus:bg-fv-neutral-200/[.3] hover:text-fv-primary-600;
|
|
79
|
+
@apply dark:text-fv-neutral-300 dark:hover:bg-fv-neutral-700/[.3] dark:focus:bg-fv-neutral-700/[.3] dark:hover:text-fv-primary-400;
|
|
80
|
+
&.fvside-active {
|
|
81
|
+
@apply border-l-fv-primary-500 bg-fv-neutral-200 hover:text-fv-neutral-600 focus:text-fv-neutral-600;
|
|
82
|
+
@apply dark:bg-fv-neutral-700 dark:hover:text-fv-neutral-300 dark:text-fv-neutral-300;
|
|
83
|
+
}
|
|
84
|
+
svg {
|
|
85
|
+
@apply w-6 h-6 mr-2 -ml-1 text-fv-neutral-400 dark:text-fv-neutral-500;
|
|
86
|
+
}
|
|
87
|
+
span {
|
|
88
|
+
@apply whitespace-nowrap;
|
|
89
|
+
}
|
|
90
|
+
transition: all 300ms ease-in-out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.fui-sidebar__md {
|
|
94
|
+
@apply w-12;
|
|
95
|
+
&.fui-sidebar__md {
|
|
96
|
+
@apply w-12;
|
|
97
|
+
}
|
|
98
|
+
.fui-sidebar__link {
|
|
99
|
+
@apply flex flex-col text-xs;
|
|
100
|
+
svg {
|
|
101
|
+
@apply mr-0;
|
|
102
|
+
}
|
|
103
|
+
span {
|
|
104
|
+
@apply hidden;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.fui-sidebar__link:hover .fui-tooltip,
|
|
108
|
+
.fui-sidebar__link:focus .fui-tooltip,
|
|
109
|
+
.fui-sidebar__link:active .fui-tooltip {
|
|
110
|
+
@apply visible opacity-100 left-11 top-0 bottom-0 flex items-center;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
@media screen and (max-width: 640px) {
|
|
115
|
+
.fui-sidebar {
|
|
116
|
+
@apply w-12;
|
|
117
|
+
&.fui-sidebar__md {
|
|
118
|
+
@apply w-12;
|
|
119
|
+
}
|
|
120
|
+
.fui-sidebar__controller {
|
|
121
|
+
@apply hidden;
|
|
122
|
+
}
|
|
123
|
+
.fui-sidebar__link {
|
|
124
|
+
@apply flex flex-col text-xs;
|
|
125
|
+
svg {
|
|
126
|
+
@apply mr-0;
|
|
127
|
+
}
|
|
128
|
+
span {
|
|
129
|
+
@apply hidden;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
.fui-sidebar__link:hover .fui-tooltip,
|
|
133
|
+
.fui-sidebar__link:focus .fui-tooltip,
|
|
134
|
+
.fui-sidebar__link:active .fui-tooltip {
|
|
135
|
+
@apply visible opacity-100 left-11 top-0 bottom-0 flex items-center;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</style>
|
package/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ import DefaultConfirm from "./components/ui/DefaultConfirm.vue";
|
|
|
33
33
|
import DefaultPaging from "./components/ui/DefaultPaging.vue";
|
|
34
34
|
import DefaultBreadcrumb from "./components/ui/DefaultBreadcrumb.vue";
|
|
35
35
|
import DefaultLoader from "./components/ui/DefaultLoader.vue";
|
|
36
|
+
import DefaultSidebar from "./components/ui/DefaultSidebar.vue";
|
|
36
37
|
|
|
37
38
|
// Components/FWS
|
|
38
39
|
import UserFlow from "./components/fws/UserFlow.vue";
|
|
@@ -113,6 +114,7 @@ export {
|
|
|
113
114
|
DefaultPaging,
|
|
114
115
|
DefaultBreadcrumb,
|
|
115
116
|
DefaultLoader,
|
|
117
|
+
DefaultSidebar,
|
|
116
118
|
|
|
117
119
|
// FWS
|
|
118
120
|
UserFlow,
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.btn {
|
|
13
|
-
@apply text-white focus:ring-4 font-medium rounded-lg text-sm focus:outline-none transition-colors ease-in-out motion-reduce:transition-none;
|
|
13
|
+
@apply inline-flex gap-3 text-white focus:ring-4 font-medium rounded-lg text-sm focus:outline-none transition-colors ease-in-out motion-reduce:transition-none;
|
|
14
14
|
&.primary {
|
|
15
15
|
@apply bg-fv-primary-700 hover:bg-fv-primary-800 focus:ring-fv-primary-300 dark:bg-fv-primary-600 dark:hover:bg-fv-primary-700 dark:focus:ring-fv-primary-800;
|
|
16
16
|
}
|
package/types.d.ts
CHANGED
package/components.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
// Generated by unplugin-vue-components
|
|
5
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
|
6
|
-
export {}
|
|
7
|
-
|
|
8
|
-
declare module 'vue' {
|
|
9
|
-
export interface GlobalComponents {
|
|
10
|
-
CollapseTransition: typeof import('./components/ui/transitions/CollapseTransition.vue')['default']
|
|
11
|
-
DefaultConfirm: typeof import('./components/ui/DefaultConfirm.vue')['default']
|
|
12
|
-
DefaultInput: typeof import('./components/ui/DefaultInput.vue')['default']
|
|
13
|
-
DefaultModal: typeof import('./components/ui/DefaultModal.vue')['default']
|
|
14
|
-
ExpandTransition: typeof import('./components/ui/transitions/ExpandTransition.vue')['default']
|
|
15
|
-
FadeTransition: typeof import('./components/ui/transitions/FadeTransition.vue')['default']
|
|
16
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
|
17
|
-
RouterView: typeof import('vue-router')['RouterView']
|
|
18
|
-
ScaleTransition: typeof import('./components/ui/transitions/ScaleTransition.vue')['default']
|
|
19
|
-
SlideTransition: typeof import('./components/ui/transitions/SlideTransition.vue')['default']
|
|
20
|
-
UserFlow: typeof import('./components/fws/UserFlow.vue')['default']
|
|
21
|
-
}
|
|
22
|
-
}
|