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
|
@@ -47,3 +47,36 @@ export const Primary: Story = {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
+
|
|
51
|
+
export const Unmount: Story = {
|
|
52
|
+
render: (args: AccordionProps) => ({
|
|
53
|
+
setup() {
|
|
54
|
+
return {
|
|
55
|
+
...args
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
components: { Accordion },
|
|
59
|
+
template: '<Accordion :contents="contents" :classes="classes" :unmount="false"></Accordion>',
|
|
60
|
+
}),
|
|
61
|
+
args: {
|
|
62
|
+
contents: [
|
|
63
|
+
{
|
|
64
|
+
title: "What's the best thing about Switzerland?",
|
|
65
|
+
body: "I don't know, but the flag is a big plus. Lorem ipsum dolor sit amet consectetur adipisicing elit. Quas cupiditate laboriosam fugiat."
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
classes: {
|
|
69
|
+
title: {
|
|
70
|
+
text: {
|
|
71
|
+
color: 'text-onSurface dark:text-onSurface-dark'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
content: {
|
|
75
|
+
text: {
|
|
76
|
+
color: 'text-onSurface dark:text-onSurface-dark'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</span>
|
|
19
19
|
</DisclosureButton>
|
|
20
20
|
</dt>
|
|
21
|
-
<DisclosurePanel as="dd" class="mt-2 pr-12">
|
|
21
|
+
<DisclosurePanel as="dd" class="mt-2 pr-12" :unmount="props.unmount">
|
|
22
22
|
<p
|
|
23
23
|
:class="[
|
|
24
24
|
mergedClasses.content?.base,
|
|
@@ -46,7 +46,11 @@ const props = defineProps({
|
|
|
46
46
|
},
|
|
47
47
|
classes: {
|
|
48
48
|
type: Object as PropType<ClassObject>,
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
unmount: {
|
|
51
|
+
type: Boolean as PropType<boolean>,
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
50
54
|
})
|
|
51
55
|
|
|
52
56
|
const defaultClasses: ClassObject = {
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</li>
|
|
12
12
|
<li v-for="(page, index) in pages" :key="page.name">
|
|
13
|
-
<div class="flex items-center">
|
|
13
|
+
<div v-if="page.name.length > 1" class="flex items-center">
|
|
14
14
|
<ChevronRightIcon
|
|
15
15
|
:class="mergedClasses.icon?.base"
|
|
16
16
|
v-if="index < pages.length - 1"
|
|
17
17
|
aria-hidden="true"
|
|
18
18
|
/>
|
|
19
19
|
<a
|
|
20
|
-
:href="`${page.href}`"
|
|
20
|
+
:href="`${getHref(page.href)}`"
|
|
21
21
|
:class="mergedClasses.text?.base"
|
|
22
22
|
:aria-current="page.current ? 'page' : undefined"
|
|
23
23
|
>
|
|
@@ -36,10 +36,15 @@ import type { RouteMeta } from 'vue-router';
|
|
|
36
36
|
import { ref, onMounted, watch, type PropType } from 'vue';
|
|
37
37
|
import type { ClassObject } from '../../types/ClassObject';
|
|
38
38
|
import { deepMergeClassObject } from '../../util';
|
|
39
|
+
import { withTrailingSlash } from 'ufo'
|
|
39
40
|
|
|
40
41
|
const props = defineProps({
|
|
41
42
|
classes: {
|
|
42
43
|
type: Object as PropType<ClassObject>,
|
|
44
|
+
},
|
|
45
|
+
trailingSlash: {
|
|
46
|
+
type: Boolean as PropType<boolean>,
|
|
47
|
+
default: false
|
|
43
48
|
}
|
|
44
49
|
})
|
|
45
50
|
|
|
@@ -97,4 +102,12 @@ function getRouteMeta(path: string): RouteMeta | undefined {
|
|
|
97
102
|
const matchedRoute = router.getRoutes().find(route => route.path === path);
|
|
98
103
|
return matchedRoute?.meta;
|
|
99
104
|
}
|
|
105
|
+
|
|
106
|
+
function getHref(path: string): string {
|
|
107
|
+
if (props.trailingSlash) {
|
|
108
|
+
return withTrailingSlash(path)
|
|
109
|
+
} else {
|
|
110
|
+
return path
|
|
111
|
+
}
|
|
112
|
+
}
|
|
100
113
|
</script>
|
package/package.json
CHANGED
|
@@ -1,36 +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 Card from './WCard.vue';
|
|
4
|
-
|
|
5
|
-
type CardProps = InstanceType<typeof Card>['$props']
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Card> = {
|
|
8
|
-
component: Card,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof Card>;
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
16
|
-
* See https://storybook.js.org/docs/api/csf
|
|
17
|
-
* to learn how to use render functions.
|
|
18
|
-
*/
|
|
19
|
-
export const Primary: Story = {
|
|
20
|
-
render: (args: CardProps) => ({
|
|
21
|
-
setup() {
|
|
22
|
-
return {
|
|
23
|
-
...args
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
components: { Card },
|
|
27
|
-
template: `
|
|
28
|
-
<Card :classes="classes">
|
|
29
|
-
<p class="text-onSurface dark:text-onSurface-dark">Card</p>
|
|
30
|
-
</Card>
|
|
31
|
-
`,
|
|
32
|
-
}),
|
|
33
|
-
args: {
|
|
34
|
-
classes: { base: 'py-4 px-4 bg-surfaceContainerLow dark:bg-surfaceContainerLow-dark border border-solid border-outline dark:border-outline-dark rounded-lg' }
|
|
35
|
-
}
|
|
36
|
-
};
|
package/basic/card/WCard.vue
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<div :class="classes.base">
|
|
4
|
-
<slot />
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import type { ClassObject } from '../../types/ClassObject';
|
|
10
|
-
import { defineProps, type PropType } from 'vue';
|
|
11
|
-
|
|
12
|
-
defineProps({
|
|
13
|
-
classes: {
|
|
14
|
-
type: Object as PropType<ClassObject>,
|
|
15
|
-
default() {
|
|
16
|
-
return {
|
|
17
|
-
base: 'bg-white border border-solid border-gray-300 rounded-lg'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
</script>
|
|
@@ -1,29 +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 Carousel from './WCarousel.vue';
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Carousel> = {
|
|
7
|
-
component: Carousel,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default meta;
|
|
11
|
-
type Story = StoryObj<typeof Carousel>;
|
|
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: { Carousel },
|
|
21
|
-
template: `
|
|
22
|
-
<Carousel>
|
|
23
|
-
<img src="/carousel-0.webp" alt="Slide 1">
|
|
24
|
-
<img src="/carousel-1.webp" alt="Slide 2">
|
|
25
|
-
<img src="/carousel-2.webp" alt="Slide 3">
|
|
26
|
-
</Carousel>
|
|
27
|
-
`,
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<div class="carousel">
|
|
4
|
-
<div class="carousel-inner" :style="{ transform: `translateX(-${currentIndex * 100}%)` }">
|
|
5
|
-
<slot/>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<SecondaryButton class="prev-btn opacity-50" @click="prev">
|
|
9
|
-
<component :is="ChevronLeftIcon" class="h-5" aria-hidden="true" />
|
|
10
|
-
</SecondaryButton>
|
|
11
|
-
|
|
12
|
-
<SecondaryButton class="next-btn opacity-50" @click="next">
|
|
13
|
-
<component :is="ChevronRightIcon" class="h-5" aria-hidden="true" />
|
|
14
|
-
</SecondaryButton>
|
|
15
|
-
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { ref, onMounted, onUnmounted } from 'vue';
|
|
21
|
-
import { ChevronRightIcon, ChevronLeftIcon } from '@heroicons/vue/24/outline';
|
|
22
|
-
import SecondaryButton from '../../template/secondary-button/WSecondaryButton.vue';
|
|
23
|
-
|
|
24
|
-
const currentIndex = ref(0);
|
|
25
|
-
const totalItems = ref(0);
|
|
26
|
-
let intervalId: number | undefined;
|
|
27
|
-
|
|
28
|
-
onMounted(() => {
|
|
29
|
-
const slotElements = document.querySelector('.carousel-inner')?.children || [];
|
|
30
|
-
totalItems.value = slotElements.length;
|
|
31
|
-
startAutoSlide();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
onUnmounted(() => {
|
|
35
|
-
stopAutoSlide();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const next = () => {
|
|
39
|
-
currentIndex.value = (currentIndex.value + 1) % totalItems.value;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const prev = () => {
|
|
43
|
-
currentIndex.value = (currentIndex.value + totalItems.value - 1) % totalItems.value;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const startAutoSlide = () => {
|
|
47
|
-
intervalId = setInterval(() => {
|
|
48
|
-
next();
|
|
49
|
-
}, 5000) as unknown as number
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const stopAutoSlide = () => {
|
|
53
|
-
if (intervalId !== undefined) {
|
|
54
|
-
clearInterval(intervalId);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<style scoped>
|
|
60
|
-
.carousel {
|
|
61
|
-
position: relative;
|
|
62
|
-
overflow: hidden;
|
|
63
|
-
}
|
|
64
|
-
.carousel-inner {
|
|
65
|
-
display: flex;
|
|
66
|
-
transition: transform 0.5s ease;
|
|
67
|
-
width: 100%;
|
|
68
|
-
}
|
|
69
|
-
.carousel-inner > * {
|
|
70
|
-
flex: 0 0 100%;
|
|
71
|
-
}
|
|
72
|
-
.prev-btn,
|
|
73
|
-
.next-btn {
|
|
74
|
-
position: absolute;
|
|
75
|
-
top: 50%;
|
|
76
|
-
transform: translateY(-50%);
|
|
77
|
-
padding: 10px 20px;
|
|
78
|
-
border: none;
|
|
79
|
-
background-color: #333;
|
|
80
|
-
color: white;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
z-index: 10;
|
|
83
|
-
}
|
|
84
|
-
.prev-btn {
|
|
85
|
-
left: 10px;
|
|
86
|
-
}
|
|
87
|
-
.next-btn {
|
|
88
|
-
right: 10px;
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Checkbox.spec.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { mount } from '@vue/test-utils';
|
|
4
|
-
import Checkbox from './Checkbox.vue';
|
|
5
|
-
|
|
6
|
-
// コンポーネントのレンダリングをテスト
|
|
7
|
-
describe('Checkbox.vue', () => {
|
|
8
|
-
it('タイトルを props 経由で受け取り、表示する', () => {
|
|
9
|
-
const title = 'コメントを受け取る';
|
|
10
|
-
const wrapper = mount(Checkbox, {
|
|
11
|
-
props: { title },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// props 経由で渡したタイトルが正しく表示されていることを確認
|
|
15
|
-
expect(wrapper.text()).toContain(title);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('チェックボックスが正しくレンダリングされる', () => {
|
|
19
|
-
const wrapper = mount(Checkbox, {
|
|
20
|
-
props: {
|
|
21
|
-
title: 'テストタイトル',
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// input 要素が存在することを確認
|
|
26
|
-
expect(wrapper.find('input[type="checkbox"]').exists()).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// it('チェックボックスがユーザーの操作に応じて状態が変化する', async () => {
|
|
30
|
-
// const wrapper = mount(Checkbox, {
|
|
31
|
-
// props: {
|
|
32
|
-
// title: 'インタラクティブテスト',
|
|
33
|
-
// },
|
|
34
|
-
// });
|
|
35
|
-
|
|
36
|
-
// // チェックボックスを見つけて、クリックする
|
|
37
|
-
// const checkbox = wrapper.find('input[type="checkbox"]');
|
|
38
|
-
// await checkbox.setValue(true);
|
|
39
|
-
|
|
40
|
-
// // チェックボックスがチェックされたことを確認
|
|
41
|
-
// expect(checkbox.element.checked).toBeTruthy();
|
|
42
|
-
// });
|
|
43
|
-
|
|
44
|
-
it('スロットを介して追加の内容をレンダリングできる', () => {
|
|
45
|
-
const wrapper = mount(Checkbox, {
|
|
46
|
-
props: {
|
|
47
|
-
title: 'スロットテスト',
|
|
48
|
-
},
|
|
49
|
-
slots: {
|
|
50
|
-
default: '<p class="additional-content">追加の内容</p>',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// スロット経由で渡された追加の内容がレンダリングされていることを確認
|
|
55
|
-
expect(wrapper.find('.additional-content').exists()).toBeTruthy();
|
|
56
|
-
expect(wrapper.text()).toContain('追加の内容');
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,51 +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 Checkbox from './Checkbox.vue';
|
|
4
|
-
|
|
5
|
-
type CheckboxProps = InstanceType<typeof Checkbox>['$props']
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Checkbox> = {
|
|
8
|
-
component: Checkbox,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof Checkbox>;
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
|
|
16
|
-
* See https://storybook.js.org/docs/api/csf
|
|
17
|
-
* to learn how to use render functions.
|
|
18
|
-
*/
|
|
19
|
-
export const Primary: Story = {
|
|
20
|
-
render: () => ({
|
|
21
|
-
components: { Checkbox },
|
|
22
|
-
template: '<Checkbox></Checkbox>',
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const WithTitle: Story = {
|
|
27
|
-
render: (args: CheckboxProps) => ({
|
|
28
|
-
setup() {
|
|
29
|
-
return {
|
|
30
|
-
...args
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
components: { Checkbox },
|
|
34
|
-
template: '<Checkbox title="利用規約に同意" :classes="classes"></Checkbox>',
|
|
35
|
-
}),
|
|
36
|
-
args: {
|
|
37
|
-
title: 'ダッシュボード',
|
|
38
|
-
classes: {
|
|
39
|
-
text: {
|
|
40
|
-
color: 'text-onSurface dark:text-onSurface-dark'
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithSlot: Story = {
|
|
47
|
-
render: () => ({
|
|
48
|
-
components: { Checkbox },
|
|
49
|
-
template: '<Checkbox><p id="comments-description" class="text-gray-500">Get notified when someones posts a comment on a posting.</p></Checkbox>',
|
|
50
|
-
}),
|
|
51
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
-
<template>
|
|
3
|
-
<fieldset>
|
|
4
|
-
<legend class="sr-only">Notifications</legend>
|
|
5
|
-
<div class="space-y-5">
|
|
6
|
-
<div class="relative flex items-start">
|
|
7
|
-
<div class="flex h-6 items-center">
|
|
8
|
-
<input id="comments" aria-describedby="comments-description" name="comments" type="checkbox" class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600" >
|
|
9
|
-
</div>
|
|
10
|
-
<div class="ml-3 text-sm leading-6">
|
|
11
|
-
<label for="comments" class="font-medium" :class="[mergedClasses.text?.color]">{{ title }}</label>
|
|
12
|
-
<slot />
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</fieldset>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { deepMergeClassObject } from '../../util';
|
|
21
|
-
import type { ClassObject } from '../../types/ClassObject';
|
|
22
|
-
import { defineProps, type PropType } from 'vue';
|
|
23
|
-
|
|
24
|
-
const props = defineProps({
|
|
25
|
-
title: {
|
|
26
|
-
type: String as PropType<string>,
|
|
27
|
-
required: true
|
|
28
|
-
},
|
|
29
|
-
classes: {
|
|
30
|
-
type: Object as PropType<ClassObject>,
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const defaultClasses: ClassObject = {
|
|
35
|
-
text: {
|
|
36
|
-
color: 'text-gray-900'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// props.classesが渡されていない場合、defaultClassesを使用する
|
|
41
|
-
const mergedClasses = props.classes ? deepMergeClassObject(defaultClasses, props.classes) : defaultClasses;
|
|
42
|
-
</script>
|
|
@@ -1,79 +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 dayjs from 'dayjs';
|
|
4
|
-
import DatePicker from './WDatePicker.vue';
|
|
5
|
-
|
|
6
|
-
type DatePickerProps = InstanceType<typeof DatePicker>['$props']
|
|
7
|
-
|
|
8
|
-
const meta: Meta<typeof DatePicker> = {
|
|
9
|
-
component: DatePicker,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default meta;
|
|
13
|
-
type Story = StoryObj<typeof DatePicker>;
|
|
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
|
-
export const Primary: Story = {
|
|
21
|
-
render: (args: DatePickerProps) => ({
|
|
22
|
-
setup() {
|
|
23
|
-
return {
|
|
24
|
-
...args
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
components: { DatePicker },
|
|
28
|
-
template: '<DatePicker :disabledDates=["2024-05-10"] :classes="classes"></DatePicker>',
|
|
29
|
-
}),
|
|
30
|
-
args: {
|
|
31
|
-
classes: {
|
|
32
|
-
text: {
|
|
33
|
-
color: 'text-onSurface dark:text-onSurface-dark'
|
|
34
|
-
},
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Range: Story = {
|
|
40
|
-
render: (args: DatePickerProps) => ({
|
|
41
|
-
setup() {
|
|
42
|
-
return {
|
|
43
|
-
...args
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
components: { DatePicker },
|
|
47
|
-
template: '<DatePicker :disabledDates=["2024-05-10"] :classes="classes" :min="min" :max="max"></DatePicker>',
|
|
48
|
-
}),
|
|
49
|
-
args: {
|
|
50
|
-
min: dayjs().add(-3, 'day').toDate(),
|
|
51
|
-
max: dayjs().add(1, 'day').toDate(),
|
|
52
|
-
classes: {
|
|
53
|
-
text: {
|
|
54
|
-
color: 'text-onSurface dark:text-onSurface-dark'
|
|
55
|
-
},
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const OldMonth: Story = {
|
|
61
|
-
render: (args: DatePickerProps) => ({
|
|
62
|
-
setup() {
|
|
63
|
-
return {
|
|
64
|
-
...args
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
components: { DatePicker },
|
|
68
|
-
template: '<DatePicker :disabledDates=["2024-05-10"] :classes="classes" :year="year" :month="month"></DatePicker>',
|
|
69
|
-
}),
|
|
70
|
-
args: {
|
|
71
|
-
year: 2000,
|
|
72
|
-
month: 1,
|
|
73
|
-
classes: {
|
|
74
|
-
text: {
|
|
75
|
-
color: 'text-onSurface dark:text-onSurface-dark'
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|