vanilla-vue-ui 0.0.11 → 0.0.13
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/basic/accordion/WAccordion.stories.ts +33 -0
- package/basic/accordion/WAccordion.vue +6 -2
- package/basic/breadcrumb/WBreadcrumb.vue +15 -2
- package/package.json +1 -1
- package/basic/card/WCard.stories.ts +0 -36
- package/basic/card/WCard.vue +0 -22
- package/basic/carousel/WCarousel.stories.ts +0 -29
- package/basic/carousel/WCarousel.vue +0 -90
- package/basic/checkbox/WCheckbox.spec.ts +0 -58
- package/basic/checkbox/WCheckbox.stories.ts +0 -51
- package/basic/checkbox/WCheckbox.vue +0 -42
- package/basic/date-picker/WDatePicker.stories.ts +0 -79
- package/basic/date-picker/WDatePicker.vue +0 -271
- package/basic/dialog/DialogStore.ts +0 -57
- package/basic/dialog/WDialog.stories.ts +0 -38
- package/basic/dialog/WDialog.vue +0 -66
- package/basic/divider/WDivider.spec.ts +0 -42
- package/basic/divider/WDivider.stories.ts +0 -40
- package/basic/divider/WDivider.vue +0 -56
- package/basic/feed/TimeLine.ts +0 -9
- package/basic/feed/WFeed.spec.ts +0 -64
- package/basic/feed/WFeed.stories.ts +0 -62
- package/basic/feed/WFeed.vue +0 -41
- package/basic/floating-button/WFloatingButton.stories.ts +0 -24
- package/basic/floating-button/WFloatingButton.vue +0 -25
- package/basic/gradient-text/WGradientText.stories.ts +0 -23
- package/basic/gradient-text/WGradientText.vue +0 -5
- package/basic/horizontal-scroll/WHorizontalScroll.stories.ts +0 -29
- package/basic/horizontal-scroll/WHorizontalScroll.vue +0 -5
- package/basic/loading/LoadingStore.ts +0 -57
- package/basic/loading/WLoading.stories.ts +0 -27
- package/basic/loading/WLoading.vue +0 -54
- package/basic/menu/Menu.stories.ts +0 -55
- package/basic/menu/WMenu.vue +0 -96
- package/basic/menu/WMenuOption.ts +0 -5
- package/basic/navigation-drawer/NavigationDrawerContent.ts +0 -11
- package/basic/navigation-drawer/WNavigationDrawer.stories.ts +0 -59
- package/basic/navigation-drawer/WNavigationDrawer.vue +0 -123
- package/basic/notification/NotificationStore.ts +0 -48
- package/basic/notification/WNotification.stories.ts +0 -27
- package/basic/notification/WNotification.vue +0 -44
- package/basic/pagination/WPagination.stories.ts +0 -30
- package/basic/pagination/WPagination.vue +0 -58
- package/basic/popup/PopupStore.ts +0 -40
- package/basic/popup/WPopup.stories.ts +0 -27
- package/basic/popup/WPopup.vue +0 -67
- package/basic/slide-over/WSlideOver.stories.ts +0 -23
- package/basic/slide-over/WSlideOver.vue +0 -53
- package/basic/step/StepContent.ts +0 -8
- package/basic/step/StepStatus.ts +0 -3
- package/basic/step/WStep.stories.ts +0 -42
- package/basic/step/WStep.vue +0 -48
- package/basic/table/WTable.stories.ts +0 -23
- package/basic/table/WTable.vue +0 -30
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<TransitionRoot as="template" :show="sidebarOpen">
|
|
4
|
-
<Dialog as="div" class="relative z-50 lg:hidden" @close="sidebarOpen = false">
|
|
5
|
-
<TransitionChild as="template" enter="transition-opacity ease-linear duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="transition-opacity ease-linear duration-300" leave-from="opacity-100" leave-to="opacity-0">
|
|
6
|
-
<div class="fixed inset-0 bg-gray-900/80" />
|
|
7
|
-
</TransitionChild>
|
|
8
|
-
|
|
9
|
-
<div class="fixed inset-0 flex">
|
|
10
|
-
<TransitionChild as="template" enter="transition ease-in-out duration-300 transform" enter-from="-translate-x-full" enter-to="translate-x-0" leave="transition ease-in-out duration-300 transform" leave-from="translate-x-0" leave-to="-translate-x-full">
|
|
11
|
-
<DialogPanel class="relative mr-16 flex w-full max-w-xs flex-1">
|
|
12
|
-
<TransitionChild as="template" enter="ease-in-out duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="ease-in-out duration-300" leave-from="opacity-100" leave-to="opacity-0">
|
|
13
|
-
<div class="absolute left-full top-0 flex w-16 justify-center pt-5">
|
|
14
|
-
<button type="button" class="-m-2.5 p-2.5" @click="sidebarOpen = false">
|
|
15
|
-
<span class="sr-only">Close sidebar</span>
|
|
16
|
-
<XMarkIcon class="h-6 w-6 text-white" aria-hidden="true" />
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
19
|
-
</TransitionChild>
|
|
20
|
-
<div class="flex grow flex-col gap-y-5 overflow-y-auto bg-white px-6 pb-2">
|
|
21
|
-
<div class="flex h-4 shrink-0 items-center"/>
|
|
22
|
-
<nav class="flex flex-1 flex-col">
|
|
23
|
-
<ul role="list" class="flex flex-1 flex-col gap-y-7">
|
|
24
|
-
<li>
|
|
25
|
-
<ul role="list" class="-mx-2 space-y-1">
|
|
26
|
-
<TreeMenu :navigation-items="navigationTop"/>
|
|
27
|
-
</ul>
|
|
28
|
-
</li>
|
|
29
|
-
|
|
30
|
-
<li class="-mx-6 mt-auto px-6 py-2">
|
|
31
|
-
<ul role="list" class="-mx-2 space-y-1">
|
|
32
|
-
<TreeMenu :navigation-items="navigationBottom"/>
|
|
33
|
-
</ul>
|
|
34
|
-
</li>
|
|
35
|
-
|
|
36
|
-
</ul>
|
|
37
|
-
</nav>
|
|
38
|
-
</div>
|
|
39
|
-
</DialogPanel>
|
|
40
|
-
</TransitionChild>
|
|
41
|
-
</div>
|
|
42
|
-
</Dialog>
|
|
43
|
-
</TransitionRoot>
|
|
44
|
-
|
|
45
|
-
<!-- Static sidebar for desktop -->
|
|
46
|
-
<div class="hidden lg:fixed lg:inset-y-0 lg:z-50 lg:flex lg:w-72 lg:flex-col">
|
|
47
|
-
<!-- Sidebar component, swap this element with another sidebar if you like -->
|
|
48
|
-
<div class="flex grow flex-col gap-y-5 overflow-y-auto border-r border-gray-200 bg-white px-6">
|
|
49
|
-
<div class="flex h-4 shrink-0 items-center">
|
|
50
|
-
<!-- <img class="h-8 w-auto" src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600" alt="Your Company" /> -->
|
|
51
|
-
</div>
|
|
52
|
-
<nav class="flex flex-1 flex-col">
|
|
53
|
-
<ul role="list" class="flex flex-1 flex-col gap-y-7">
|
|
54
|
-
<li>
|
|
55
|
-
<ul role="list" class="-mx-2 space-y-1">
|
|
56
|
-
<TreeMenu :navigation-items="navigationTop"/>
|
|
57
|
-
</ul>
|
|
58
|
-
</li>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<li class="-mx-6 mt-auto p-6 px-2">
|
|
62
|
-
<ul role="list" class="mx-2 space-y-1">
|
|
63
|
-
<TreeMenu :navigation-items="navigationBottom"/>
|
|
64
|
-
</ul>
|
|
65
|
-
</li>
|
|
66
|
-
</ul>
|
|
67
|
-
</nav>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<AppBar :title="title" @open="sidebarOpen = true"/>
|
|
72
|
-
|
|
73
|
-
<main class="lg:pl-72">
|
|
74
|
-
<div class="">
|
|
75
|
-
<!-- Your content -->
|
|
76
|
-
<slot />
|
|
77
|
-
</div>
|
|
78
|
-
</main>
|
|
79
|
-
</div>
|
|
80
|
-
</template>
|
|
81
|
-
|
|
82
|
-
<script setup lang="ts">
|
|
83
|
-
import type { NavigationDrawerContent } from './NavigationDrawerContent'
|
|
84
|
-
import { ref, watch, type PropType } from 'vue'
|
|
85
|
-
import { useRoute } from 'vue-router'
|
|
86
|
-
import { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
|
87
|
-
import {
|
|
88
|
-
XMarkIcon,
|
|
89
|
-
} from '@heroicons/vue/24/outline'
|
|
90
|
-
import TreeMenu from '../tree-menu/TreeMenu.vue'
|
|
91
|
-
import AppBar from '../app-bar/AppBar.vue'
|
|
92
|
-
|
|
93
|
-
const props = defineProps({
|
|
94
|
-
title: {
|
|
95
|
-
type: String as PropType<string>,
|
|
96
|
-
default: "Dashboard"
|
|
97
|
-
},
|
|
98
|
-
navigationTop: {
|
|
99
|
-
type: Array as PropType<NavigationDrawerContent[]>,
|
|
100
|
-
required: true
|
|
101
|
-
},
|
|
102
|
-
navigationBottom: {
|
|
103
|
-
type: Array as PropType<NavigationDrawerContent[]>,
|
|
104
|
-
required: true
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
const navigationTop = ref(props.navigationTop)
|
|
109
|
-
const navigationBottom = ref(props.navigationBottom)
|
|
110
|
-
|
|
111
|
-
const sidebarOpen = ref(false)
|
|
112
|
-
|
|
113
|
-
const route = useRoute()
|
|
114
|
-
|
|
115
|
-
watch(route, (newRoute) => {
|
|
116
|
-
// current、isOpen を設定
|
|
117
|
-
navigationTop.value.forEach(item => {
|
|
118
|
-
item.current = item.href === newRoute.path;
|
|
119
|
-
// current だったら sub を表示させる
|
|
120
|
-
item.isOpen = true
|
|
121
|
-
});
|
|
122
|
-
}, { immediate: true });
|
|
123
|
-
</script>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue'
|
|
2
|
-
import { defineStore } from 'pinia'
|
|
3
|
-
|
|
4
|
-
export const NotificationStore = defineStore('notification', () => {
|
|
5
|
-
|
|
6
|
-
// リアクティブにするために ref を使用する
|
|
7
|
-
const _isOpen = ref(false)
|
|
8
|
-
let _completion: (() => void) | null = null
|
|
9
|
-
|
|
10
|
-
const _title = ref('')
|
|
11
|
-
const _description = ref('')
|
|
12
|
-
|
|
13
|
-
// computed にすることで直接変更できなくする
|
|
14
|
-
const isOpen = computed(() => _isOpen)
|
|
15
|
-
const title = computed(() => _title)
|
|
16
|
-
const description = computed(() => _description)
|
|
17
|
-
|
|
18
|
-
function open({ title = '', description = '', delay = 3000, completion = null }: { title: string, description: string, delay?: number, completion?: (() => void) | null }) {
|
|
19
|
-
_title.value = title
|
|
20
|
-
_description.value = description
|
|
21
|
-
|
|
22
|
-
_isOpen.value = true
|
|
23
|
-
|
|
24
|
-
_completion = completion
|
|
25
|
-
|
|
26
|
-
// 余韻を残して非表示にs
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
close()
|
|
29
|
-
}, delay);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function close() {
|
|
33
|
-
|
|
34
|
-
_isOpen.value = false
|
|
35
|
-
|
|
36
|
-
// コールバック関数が含まれていれば実行
|
|
37
|
-
if (_completion) {
|
|
38
|
-
|
|
39
|
-
// 実行
|
|
40
|
-
_completion()
|
|
41
|
-
|
|
42
|
-
// リセット
|
|
43
|
-
_completion = null
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return { isOpen, open, close, title, description }
|
|
48
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Replace vue3 with vue if you are using Storybook for Vue 2
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
-
import { NotificationStore } from './NotificationStore';
|
|
4
|
-
import Notification from './Notification.vue';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Notification> = {
|
|
7
|
-
component: Notification,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof Notification>;
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
15
|
-
* See https://storybook.js.org/docs/api/csf
|
|
16
|
-
* to learn how to use render functions.
|
|
17
|
-
*/
|
|
18
|
-
export const Primary: Story = {
|
|
19
|
-
render: () => ({
|
|
20
|
-
setup() {
|
|
21
|
-
const notificationStore = NotificationStore()
|
|
22
|
-
notificationStore.open({ title: 'タイトル', description: 'ここに説明文が表示さえます。'})
|
|
23
|
-
},
|
|
24
|
-
components: { Notification },
|
|
25
|
-
template: '<Notification></Notification>',
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<div aria-live="assertive" class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6">
|
|
4
|
-
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
|
5
|
-
<transition enter-active-class="transform ease-out duration-300 transition" enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2" enter-to-class="translate-y-0 opacity-100 sm:translate-x-0" leave-active-class="transition ease-in duration-100" leave-from-class="opacity-100" leave-to-class="opacity-0">
|
|
6
|
-
<div v-show="showNotification" class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
|
|
7
|
-
<div class="p-4">
|
|
8
|
-
<div class="flex items-start">
|
|
9
|
-
<div class="flex-shrink-0">
|
|
10
|
-
<CheckCircleIcon class="h-6 w-6 text-green-400" aria-hidden="true" />
|
|
11
|
-
</div>
|
|
12
|
-
<div class="ml-3 w-0 flex-1 pt-0.5">
|
|
13
|
-
<p class="text-sm font-medium text-gray-900">{{ notificationStore.title.value }}</p>
|
|
14
|
-
<p class="mt-1 text-sm text-gray-500">{{ notificationStore.description.value }}</p>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="ml-4 flex flex-shrink-0">
|
|
17
|
-
<button type="button" class="inline-flex rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" @click="close()">
|
|
18
|
-
<span class="sr-only">Close</span>
|
|
19
|
-
<XMarkIcon class="h-5 w-5" aria-hidden="true" />
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</transition>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script setup lang="ts">
|
|
31
|
-
import { CheckCircleIcon } from '@heroicons/vue/24/outline'
|
|
32
|
-
import { XMarkIcon } from '@heroicons/vue/20/solid'
|
|
33
|
-
import { NotificationStore } from './NotificationStore'
|
|
34
|
-
|
|
35
|
-
// 通知用 state を購読
|
|
36
|
-
const notificationStore = NotificationStore()
|
|
37
|
-
const showNotification = notificationStore.isOpen
|
|
38
|
-
|
|
39
|
-
// 通知を閉じる
|
|
40
|
-
function close() {
|
|
41
|
-
notificationStore.close()
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
</script>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Replace vue3 with vue if you are using Storybook for Vue 2
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
-
|
|
4
|
-
import Pagination from './Pagination.vue';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Pagination> = {
|
|
7
|
-
component: Pagination,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof Pagination>;
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
15
|
-
* See https://storybook.js.org/docs/api/csf
|
|
16
|
-
* to learn how to use render functions.
|
|
17
|
-
*/
|
|
18
|
-
export const Primary: Story = {
|
|
19
|
-
render: () => ({
|
|
20
|
-
components: { Pagination },
|
|
21
|
-
template: '<Pagination nextPath="#" previousPath="#"></Pagination>',
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Disable: Story = {
|
|
26
|
-
render: () => ({
|
|
27
|
-
components: { Pagination },
|
|
28
|
-
template: '<Pagination></Pagination>',
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<nav class="flex items-center justify-between border-t border-gray-200 px-4 sm:px-0">
|
|
4
|
-
<div class="-mt-px flex w-0 flex-1">
|
|
5
|
-
<a
|
|
6
|
-
v-if="props.previousPath"
|
|
7
|
-
:href="props.previousPath"
|
|
8
|
-
class="inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700"
|
|
9
|
-
>
|
|
10
|
-
<ArrowLongLeftIcon class="mr-3 size-5 text-gray-400" aria-hidden="true" />
|
|
11
|
-
Previous
|
|
12
|
-
</a>
|
|
13
|
-
<span
|
|
14
|
-
v-else
|
|
15
|
-
class="inline-flex items-center border-t-2 border-transparent pr-1 pt-4 text-sm font-medium text-gray-300 cursor-not-allowed"
|
|
16
|
-
>
|
|
17
|
-
<ArrowLongLeftIcon class="mr-3 size-5 text-gray-300" aria-hidden="true" />
|
|
18
|
-
Previous
|
|
19
|
-
</span>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div class="-mt-px flex w-0 flex-1 justify-end">
|
|
23
|
-
<a
|
|
24
|
-
v-if="props.nextPath"
|
|
25
|
-
:href="props.nextPath"
|
|
26
|
-
class="inline-flex items-center border-t-2 border-transparent pl-1 pt-4 text-sm font-medium text-gray-500 hover:border-gray-300 hover:text-gray-700"
|
|
27
|
-
>
|
|
28
|
-
Next
|
|
29
|
-
<ArrowLongRightIcon class="ml-3 size-5 text-gray-400" aria-hidden="true" />
|
|
30
|
-
</a>
|
|
31
|
-
<span
|
|
32
|
-
v-else
|
|
33
|
-
class="inline-flex items-center border-t-2 border-transparent pl-1 pt-4 text-sm font-medium text-gray-300 cursor-not-allowed"
|
|
34
|
-
>
|
|
35
|
-
Next
|
|
36
|
-
<ArrowLongRightIcon class="ml-3 size-5 text-gray-300" aria-hidden="true" />
|
|
37
|
-
</span>
|
|
38
|
-
</div>
|
|
39
|
-
</nav>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script setup lang="ts">
|
|
43
|
-
import { ArrowLongLeftIcon, ArrowLongRightIcon } from '@heroicons/vue/20/solid'
|
|
44
|
-
import { defineProps, type PropType } from 'vue';
|
|
45
|
-
|
|
46
|
-
const props = defineProps({
|
|
47
|
-
nextPath: {
|
|
48
|
-
type: String as PropType<string | null>,
|
|
49
|
-
required: false,
|
|
50
|
-
default: null
|
|
51
|
-
},
|
|
52
|
-
previousPath: {
|
|
53
|
-
type: String as PropType<string | null>,
|
|
54
|
-
required: false,
|
|
55
|
-
default: null
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
</script>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ref, computed } from 'vue'
|
|
2
|
-
import { defineStore } from 'pinia'
|
|
3
|
-
|
|
4
|
-
export const PopupStore = defineStore('dialog', () => {
|
|
5
|
-
|
|
6
|
-
// リアクティブにするために ref を使用する
|
|
7
|
-
const _isOpen = ref(false)
|
|
8
|
-
let _completion: ((isConfirmed: boolean | null) => void) | null = null
|
|
9
|
-
// true にするとダイアログ以外の場所をタップしても消えない
|
|
10
|
-
// ボタンでしか閉じれなくなる
|
|
11
|
-
const _persistent = ref(false)
|
|
12
|
-
|
|
13
|
-
// computed にすることで直接変更できなくする
|
|
14
|
-
const isOpen = computed(() => _isOpen)
|
|
15
|
-
const getPersistent = computed(() => _persistent)
|
|
16
|
-
|
|
17
|
-
function open({ persistent = false, completion = null }: { persistent?: boolean; completion?: ((isConfirmed: boolean | null) => void) | null }) {
|
|
18
|
-
_persistent.value = persistent
|
|
19
|
-
_isOpen.value = true
|
|
20
|
-
_completion = completion
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function close({ isConfirmed = null }: { isConfirmed?: boolean | null }) {
|
|
24
|
-
|
|
25
|
-
_isOpen.value = false
|
|
26
|
-
_persistent.value = false
|
|
27
|
-
|
|
28
|
-
// コールバック関数が含まれていれば実行
|
|
29
|
-
if (_completion) {
|
|
30
|
-
|
|
31
|
-
// 実行
|
|
32
|
-
_completion(isConfirmed)
|
|
33
|
-
|
|
34
|
-
// リセット
|
|
35
|
-
_completion = null
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return { isOpen, getPersistent, open, close }
|
|
40
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Replace vue3 with vue if you are using Storybook for Vue 2
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
-
import { PopupStore } from './PopupStore';
|
|
4
|
-
import Popup from './Popup.vue';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Popup> = {
|
|
7
|
-
component: Popup,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof Popup>;
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
15
|
-
* See https://storybook.js.org/docs/api/csf
|
|
16
|
-
* to learn how to use render functions.
|
|
17
|
-
*/
|
|
18
|
-
export const Primary: Story = {
|
|
19
|
-
render: () => ({
|
|
20
|
-
setup() {
|
|
21
|
-
const popupStore = PopupStore()
|
|
22
|
-
popupStore.open({ persistent: true })
|
|
23
|
-
},
|
|
24
|
-
components: { Popup },
|
|
25
|
-
template: '<Popup><p>こんにちわ</p></Popup>',
|
|
26
|
-
}),
|
|
27
|
-
};
|
package/basic/popup/WPopup.vue
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<TransitionRoot as="template" :show="isOpen">
|
|
4
|
-
<Dialog as="div" class="relative z-10" @close="close({ isConfirmed: null })">
|
|
5
|
-
<TransitionChild as="template" enter="ease-out duration-300" enter-from="opacity-0" enter-to="opacity-100" leave="ease-in duration-200" leave-from="opacity-100" leave-to="opacity-0">
|
|
6
|
-
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
|
|
7
|
-
</TransitionChild>
|
|
8
|
-
|
|
9
|
-
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
|
|
10
|
-
<div class="flex min-h-full items-center justify-center p-4 text-center sm:p-0">
|
|
11
|
-
<TransitionChild as="template" enter="ease-out duration-300" enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" enter-to="opacity-100 translate-y-0 sm:scale-100" leave="ease-in duration-200" leave-from="opacity-100 translate-y-0 sm:scale-100" leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95">
|
|
12
|
-
<DialogPanel :class="fullClassObject" class="relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 w-full sm:w-full sm:max-w-sm sm:p-6">
|
|
13
|
-
<div :class="{ 'flex-grow': full }" class="">
|
|
14
|
-
<div class="relative">
|
|
15
|
-
<div class="absolute top-0 right-0 z-[41]">
|
|
16
|
-
<XmarkSolidIcon @click="forceClose"/>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<slot />
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</DialogPanel>
|
|
23
|
-
</TransitionChild>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</Dialog>
|
|
27
|
-
</TransitionRoot>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<script setup lang="ts">
|
|
31
|
-
import type { PropType } from 'vue'
|
|
32
|
-
import { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
|
33
|
-
import { PopupStore } from './PopupStore'
|
|
34
|
-
import XmarkSolidIcon from '../../icon/xmark/XmarkSolidIcon.vue';
|
|
35
|
-
|
|
36
|
-
const props = defineProps({
|
|
37
|
-
full: {
|
|
38
|
-
type: Boolean as PropType<boolean>,
|
|
39
|
-
default: false
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
const fullClassObject = {
|
|
44
|
-
'flex': props.full,
|
|
45
|
-
'flex-col': props.full,
|
|
46
|
-
'min-h-screen': props.full
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ダイアログ用 state を購読
|
|
50
|
-
const dialogStore = PopupStore()
|
|
51
|
-
// ストアの状態とアクションをコンポーネントにマッピング
|
|
52
|
-
const isOpen = dialogStore.isOpen;
|
|
53
|
-
const persistent = dialogStore.getPersistent
|
|
54
|
-
|
|
55
|
-
// ダイアログを閉じる
|
|
56
|
-
function close({ isConfirmed }: { isConfirmed: boolean | null }) {
|
|
57
|
-
|
|
58
|
-
// 回答が強制されていて、ボタンを押してない場合はダイアログを閉じさせない
|
|
59
|
-
if (persistent.value == false || isConfirmed != null) {
|
|
60
|
-
dialogStore.close({ isConfirmed: isConfirmed })
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function forceClose() {
|
|
65
|
-
dialogStore.close({ isConfirmed: null})
|
|
66
|
-
}
|
|
67
|
-
</script>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Replace vue3 with vue if you are using Storybook for Vue 2
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
-
|
|
4
|
-
import SlideOver from './WSlideOver.vue';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof SlideOver> = {
|
|
7
|
-
component: SlideOver,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof SlideOver>;
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
15
|
-
* See https://storybook.js.org/docs/api/csf
|
|
16
|
-
* to learn how to use render functions.
|
|
17
|
-
*/
|
|
18
|
-
export const Primary: Story = {
|
|
19
|
-
render: () => ({
|
|
20
|
-
components: { SlideOver },
|
|
21
|
-
template: '<SlideOver isOpen="true"></SlideOver>',
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<TransitionRoot as="template" :show="isOpen">
|
|
3
|
-
<Dialog as="div" class="relative z-50" @close="close">
|
|
4
|
-
<div class="fixed inset-0" />
|
|
5
|
-
|
|
6
|
-
<div class="fixed inset-0 overflow-hidden">
|
|
7
|
-
<div class="absolute inset-0 overflow-hidden">
|
|
8
|
-
<div class="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10">
|
|
9
|
-
<TransitionChild as="template" enter="transform transition ease-in-out duration-500 sm:duration-700" enter-from="translate-x-full" enter-to="translate-x-0" leave="transform transition ease-in-out duration-500 sm:duration-700" leave-from="translate-x-0" leave-to="translate-x-full">
|
|
10
|
-
<DialogPanel class="pointer-events-auto w-screen max-w-md">
|
|
11
|
-
<div class="flex h-full flex-col overflow-y-scroll bg-white py-6 shadow-xl">
|
|
12
|
-
<div class="px-4 sm:px-6">
|
|
13
|
-
<div class="flex items-start justify-end">
|
|
14
|
-
<div class="ml-3 flex h-7 items-center">
|
|
15
|
-
<button type="button" class="relative rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2" @click="close">
|
|
16
|
-
<span class="absolute -inset-2.5" />
|
|
17
|
-
<span class="sr-only">Close panel</span>
|
|
18
|
-
<XMarkIcon class="h-6 w-6" aria-hidden="true" />
|
|
19
|
-
</button>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<slot />
|
|
23
|
-
</div>
|
|
24
|
-
<div class="relative mt-6 flex-1 px-4 sm:px-6"/>
|
|
25
|
-
</div>
|
|
26
|
-
</DialogPanel>
|
|
27
|
-
</TransitionChild>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</Dialog>
|
|
32
|
-
</TransitionRoot>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script setup lang="ts">
|
|
36
|
-
import { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
|
37
|
-
import { XMarkIcon } from '@heroicons/vue/24/outline'
|
|
38
|
-
import { defineProps, defineEmits } from 'vue'
|
|
39
|
-
|
|
40
|
-
defineProps({
|
|
41
|
-
isOpen: Boolean
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
// const open = ref(true)
|
|
45
|
-
|
|
46
|
-
// イベントの定義
|
|
47
|
-
const emit = defineEmits(['update:isOpen'])
|
|
48
|
-
|
|
49
|
-
const close = () => {
|
|
50
|
-
// Emit an event to notify parent component to change the state
|
|
51
|
-
emit('update:isOpen', false)
|
|
52
|
-
}
|
|
53
|
-
</script>
|
package/basic/step/StepStatus.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Replace vue3 with vue if you are using Storybook for Vue 2
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
3
|
-
import Step from './Step.vue';
|
|
4
|
-
import type { StepContent } from './StepContent'
|
|
5
|
-
|
|
6
|
-
type StepProps = InstanceType<typeof Step>['$props']
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof Step> = {
|
|
9
|
-
component: Step,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof Step>;
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
17
|
-
* See https://storybook.js.org/docs/api/csf
|
|
18
|
-
* to learn how to use render functions.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const steps: StepContent[] = [
|
|
22
|
-
{ number: 1, status: 'Complete' },
|
|
23
|
-
{ number: 2, status: 'Complete' },
|
|
24
|
-
{ number: 3, status: 'Complete' },
|
|
25
|
-
{ number: 4, status: 'Current' },
|
|
26
|
-
{ number: 5, status: 'Upcoming' },
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
export const Primary: Story = {
|
|
30
|
-
render: (args: StepProps) => ({
|
|
31
|
-
setup() {
|
|
32
|
-
return {
|
|
33
|
-
...args,
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
components: { Step },
|
|
37
|
-
template: '<Step :steps="steps"></Step>',
|
|
38
|
-
}),
|
|
39
|
-
args: {
|
|
40
|
-
steps: steps
|
|
41
|
-
},
|
|
42
|
-
};
|
package/basic/step/WStep.vue
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<div v-if="steps" class="flex justify-center">
|
|
4
|
-
<nav aria-label="Progress">
|
|
5
|
-
<ol role="list" class="flex items-center">
|
|
6
|
-
<li v-for="(step, stepIdx) in steps" :key="step.number" :class="[stepIdx !== steps.length - 1 ? 'pr-8 sm:pr-20' : '', 'relative']">
|
|
7
|
-
<template v-if="step.status === 'Complete'">
|
|
8
|
-
<div class="absolute inset-0 flex items-center" aria-hidden="true">
|
|
9
|
-
<div class="h-0.5 w-full bg-indigo-600" />
|
|
10
|
-
</div>
|
|
11
|
-
<div class="relative flex h-8 w-8 items-center justify-center rounded-full bg-indigo-600 hover:bg-indigo-900">
|
|
12
|
-
<CheckIcon class="h-5 w-5 text-white" aria-hidden="true" />
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
<template v-else-if="step.status === 'Current'">
|
|
16
|
-
<div class="absolute inset-0 flex items-center" aria-hidden="true">
|
|
17
|
-
<div class="h-0.5 w-full bg-gray-200" />
|
|
18
|
-
</div>
|
|
19
|
-
<div class="relative flex h-8 w-8 items-center justify-center rounded-full border-2 border-indigo-600 bg-white" aria-current="step">
|
|
20
|
-
<span class="h-2.5 w-2.5 rounded-full bg-indigo-600" aria-hidden="true" />
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
<template v-else>
|
|
24
|
-
<div class="absolute inset-0 flex items-center" aria-hidden="true">
|
|
25
|
-
<div class="h-0.5 w-full bg-gray-200" />
|
|
26
|
-
</div>
|
|
27
|
-
<div class="group relative flex h-8 w-8 items-center justify-center rounded-full border-2 border-gray-300 bg-white hover:border-gray-400">
|
|
28
|
-
<span class="h-2.5 w-2.5 rounded-full bg-transparent group-hover:bg-gray-300" aria-hidden="true" />
|
|
29
|
-
</div>
|
|
30
|
-
</template>
|
|
31
|
-
</li>
|
|
32
|
-
</ol>
|
|
33
|
-
</nav>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script setup lang="ts">
|
|
38
|
-
import { defineProps, type PropType } from 'vue'
|
|
39
|
-
import { CheckIcon } from '@heroicons/vue/20/solid'
|
|
40
|
-
import type { StepContent } from './StepContent';
|
|
41
|
-
|
|
42
|
-
defineProps({
|
|
43
|
-
steps: {
|
|
44
|
-
type: Array as PropType<StepContent[]>,
|
|
45
|
-
require: true
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
</script>
|