vanilla-vue-ui 0.0.1 → 0.0.2

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.
Files changed (29) hide show
  1. package/basic/app-bar/WAppBar.stories.ts +41 -0
  2. package/basic/app-bar/WAppBar.vue +48 -0
  3. package/basic/banner/BannerStore.ts +54 -0
  4. package/basic/banner/WBanner.stories.ts +28 -0
  5. package/basic/banner/WBanner.vue +41 -0
  6. package/basic/breadcrumb/WBreadcrumb.stories.ts +25 -0
  7. package/basic/breadcrumb/WBreadcrumb.vue +97 -0
  8. package/basic/button/WButton.stories.ts +10 -3
  9. package/basic/button/WButton.vue +3 -3
  10. package/basic/icon/WIcon.vue +5 -0
  11. package/basic/range/WRange.vue +113 -17
  12. package/basic/text-field/TextFieldSize.ts +2 -0
  13. package/basic/text-field/WTextField.stories.ts +88 -0
  14. package/basic/text-field/WTextField.vue +188 -0
  15. package/package.json +1 -1
  16. package/template/footer-simple/WFooterSimple.stories.ts +23 -0
  17. package/template/footer-simple/WFooterSimple.vue +20 -0
  18. package/template/navigation-drawer/NavigationDrawer.stories.ts +59 -0
  19. package/template/navigation-drawer/NavigationDrawer.vue +121 -0
  20. package/template/navigation-drawer/NavigationDrawerContent.ts +11 -0
  21. package/template/primary-button/WPrimaryButton.spec.ts +17 -0
  22. package/template/primary-button/WPrimaryButton.stories.ts +30 -0
  23. package/template/primary-button/WPrimaryButton.vue +9 -0
  24. package/template/secondary-button/WSecondaryButton.spec.ts +17 -0
  25. package/template/secondary-button/WSecondaryButton.stories.ts +30 -0
  26. package/template/secondary-button/WSecondaryButton.vue +9 -0
  27. package/template/tree-menu/TreeMenuContent.ts +11 -0
  28. package/template/tree-menu/WTreeMenu.stories.ts +55 -0
  29. package/template/tree-menu/WTreeMenu.vue +152 -0
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <ul role="list" class="flex flex-1 flex-col gap-y-7">
3
+ <li>
4
+ <ul role="list" class="-mx-2 space-y-1">
5
+ <li v-for="item in navigationItems" :key="item.name">
6
+
7
+ <SecondaryButton v-if="item.onClick" block @click="clickNavigation(item.onClick)">
8
+ <component :is="item.icon" :class="[item.current ? 'text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark group-hover:text-primary dark:group-hover:text-primary-dark', 'h-6 w-6 shrink-0 inline mx-2']" aria-hidden="true" />
9
+ {{ item.name }}
10
+ </SecondaryButton>
11
+
12
+ <!-- メインアイテム -->
13
+ <div v-else class="flex hover:bg-surfaceHover dark:hover:bg-surfaceHover-dark text-onSurface dark:text-onSurface-dark hover:text-primary dark:hover:text-primary-dark rounded-xl">
14
+
15
+ <!-- メインアイテム(リンク) -->
16
+ <a
17
+ v-if="item.subItems === undefined"
18
+ :href="item.href"
19
+ :class="[
20
+ item.current ? 'bg-surfaceHover dark:bg-surfaceHover-dark text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark hover:text-primary dark:hover:text-primary-dark hover:bg-surfaceHover dark:hover:bg-surfaceHover-dark',
21
+ 'group flex-auto flex gap-x-3 rounded-xl p-2 text-sm leading-6 font-semibold'
22
+ ]"
23
+ >
24
+ <component
25
+ :is="item.icon"
26
+ :class="[
27
+ item.current ? 'text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark group-hover:text-primary dark:group-hover:text-primary-dark',
28
+ 'h-6 w-6 shrink-0'
29
+ ]"
30
+ aria-hidden="true"
31
+ />
32
+ {{ item.name }}
33
+ </a>
34
+
35
+ <!-- メインアイテム(矢印) -->
36
+ <span
37
+ v-else
38
+ :class="[
39
+ item.current ? 'bg-surfaceHover dark:bg-surfaceHover-dark text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark hover:text-primary dark:hover:text-primary-dark hover:bg-surfaceHover dark:hover:bg-surfaceHover-dark',
40
+ 'group flex-auto flex gap-x-3 rounded-xl p-2 text-sm leading-6 font-semibold'
41
+ ]"
42
+ @click="toggleSubItems(item)">
43
+
44
+ <!-- <div class="text-onSurface dark:text-onSurface-dark"> -->
45
+ <component
46
+ :is="ChevronRightIcon"
47
+ v-if="item.isOpen === false"
48
+ :class="[
49
+ 'text-onSurface dark:text-onSurface-dark',
50
+ 'h-6 w-6 shrink-0 inline'
51
+ ]"
52
+ />
53
+ <component
54
+ :is="ChevronDownIcon"
55
+ v-if="item.isOpen === true"
56
+ :class="[
57
+ 'text-onSurface dark:text-onSurface-dark',
58
+ 'h-6 w-6 shrink-0 inline'
59
+ ]"
60
+ />
61
+ <!-- </div> -->
62
+
63
+ <!-- ここまで -->
64
+ <component
65
+ :is="item.icon"
66
+ :class="[
67
+ item.current ? 'text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark group-hover:text-primary dark:group-hover:text-primary-dark',
68
+ 'h-6 w-6 shrink-0'
69
+ ]"
70
+ aria-hidden="true"
71
+ />
72
+ {{ item.name }}
73
+ </span>
74
+ </div>
75
+
76
+ <!-- サブアイテム -->
77
+ <template v-if="item.subItems && item.isOpen === true">
78
+ <ul role="list" class="ml-4 space-y-1">
79
+ <li v-for="subItem in item.subItems" :key="subItem.name">
80
+ <SecondaryButton v-if="subItem.onClick" block @click="clickNavigation(subItem.onClick)">
81
+ <component :is="subItem.icon" :class="[subItem.current ? 'text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark group-hover:text-primary dark:group-hover:text-primary-dark', 'h-6 w-6 shrink-0 inline mx-2']" aria-hidden="true" />
82
+ {{ subItem.name }}
83
+ </SecondaryButton>
84
+
85
+ <a
86
+ v-else
87
+ :href="subItem.href"
88
+ :class="[
89
+ subItem.current ? 'bg-surfaceHover dark:bg-surfaceHover-dark text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark hover:text-primary dark:hover:text-primary-dark hover:bg-surfaceHover dark:hover:bg-surfaceHover-dark',
90
+ 'group flex gap-x-3 rounded-xl p-2 text-sm leading-6 font-semibold'
91
+ ]"
92
+ >
93
+ <component
94
+ :is="subItem.icon"
95
+ :class="[
96
+ subItem.current ? 'text-primary dark:text-primary-dark' : 'text-onSurface dark:text-onSurface-dark group-hover:text-primary dark:group-hover:text-primary-dark',
97
+ 'h-6 w-6 shrink-0'
98
+ ]"
99
+ aria-hidden="true"
100
+ />
101
+ {{ subItem.name }}
102
+ </a>
103
+ </li>
104
+ </ul>
105
+ </template>
106
+ </li>
107
+ </ul>
108
+ </li>
109
+ </ul>
110
+ </template>
111
+
112
+ <script setup lang="ts">
113
+ import type { TreeMenuContent } from './TreeMenuContent'
114
+ import { ref, type PropType } from 'vue'
115
+ import {
116
+ ChevronRightIcon,
117
+ ChevronDownIcon
118
+ } from '@heroicons/vue/24/outline'
119
+ import SecondaryButton from '../secondary-button/WSecondaryButton.vue'
120
+
121
+ const props = defineProps({
122
+ navigationItems: {
123
+ type: Array as PropType<TreeMenuContent[]>,
124
+ required: true
125
+ }
126
+ })
127
+
128
+ const navigationItems = ref(props.navigationItems)
129
+
130
+ function clickNavigation(func: (() => void) | null | undefined) {
131
+ if (func) {
132
+ func();
133
+ } else {
134
+ console.error("func is null or undefined");
135
+ }
136
+ }
137
+
138
+ function toggleSubItems(item: TreeMenuContent) {
139
+ navigationItems.value = navigationItems.value.map((currentItem: TreeMenuContent) => {
140
+ if (currentItem.name === item.name) {
141
+
142
+ if (currentItem.isOpen === true) {
143
+ currentItem.isOpen = false
144
+ } else {
145
+ currentItem.isOpen = true
146
+ }
147
+
148
+ }
149
+ return currentItem
150
+ })
151
+ }
152
+ </script>