@volverjs/ui-vue 0.0.1-beta.2 → 0.0.1-beta.5
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/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/stories/Button/Button.test.d.ts +11 -0
- package/dist/test/expect.d.ts +13 -0
- package/dist/ui-vue.es.js +3 -3
- package/dist/ui-vue.umd.js +1 -1
- package/package.json +4 -2
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +0 -1
- package/src/stories/Button/Button.stories.mdx +2 -8
- package/src/stories/Button/Button.test.ts +57 -0
- package/src/stories/Button/ButtonBadge.stories.mdx +2 -1
- package/src/stories/Button/ButtonIcon.stories.mdx +3 -11
- package/src/stories/Button/ButtonIconPosition.stories.mdx +17 -14
- package/src/stories/Button/ButtonLink.stories.mdx +13 -44
- package/src/stories/Button/ButtonLoading.stories.mdx +22 -3
- package/src/stories/Button/ButtonModifiers.stories.mdx +30 -44
- package/src/stories/Button/ButtonVariant.stories.mdx +33 -51
- package/src/stories/volver-ui-vue.stories.mdx +2 -1
- package/src/test/expect.ts +52 -0
- package/src/test/types.d.ts +3 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
|
-
// import vueRouter from 'storybook-vue3-router'
|
|
3
2
|
import ObjectUtilities from '../../utils/ObjectUtilities'
|
|
4
3
|
import VvBreadcrumb from '../../components/VvBreadcrumb/VvBreadcrumb.vue'
|
|
5
4
|
import { VvBreadcrumbProps } from '../../components/VvBreadcrumb/VvBreadcrumb'
|
|
@@ -5,6 +5,7 @@ import { expect } from '@storybook/jest'
|
|
|
5
5
|
import ObjectUtilities from '../../utils/ObjectUtilities'
|
|
6
6
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
7
7
|
import { VvButtonProps } from '../../components/VvButton/VvButton'
|
|
8
|
+
import { testButton } from './Button.test'
|
|
8
9
|
|
|
9
10
|
<Meta
|
|
10
11
|
title="Components/Button"
|
|
@@ -61,13 +62,6 @@ export const Template = (args) => ({
|
|
|
61
62
|
Stories of `VvButton`.
|
|
62
63
|
Let's define a story for our playground `button`:
|
|
63
64
|
|
|
64
|
-
<Story
|
|
65
|
-
name="vv-button"
|
|
66
|
-
args={{}}
|
|
67
|
-
play={async ({ args, canvasElement }) => {
|
|
68
|
-
const canvas = within(canvasElement)
|
|
69
|
-
await userEvent.click(canvas.getByRole('button'))
|
|
70
|
-
await expect.extend(toHaveNoViolations)
|
|
71
|
-
}}>
|
|
65
|
+
<Story name="vv-button" args={{}} play={testButton}>
|
|
72
66
|
{Template.bind({})}
|
|
73
67
|
</Story>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PlayAttributes } from '@/test/types'
|
|
2
|
+
import { within } from '@storybook/testing-library'
|
|
3
|
+
import { expect } from '@/test/expect'
|
|
4
|
+
|
|
5
|
+
interface ButtonConfig {
|
|
6
|
+
isClickDisabled?: boolean
|
|
7
|
+
className?: string | string[] | null
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function testButton(
|
|
11
|
+
{ canvasElement }: PlayAttributes = {} as PlayAttributes,
|
|
12
|
+
{ isClickDisabled = false, className = null }: ButtonConfig = {}
|
|
13
|
+
) {
|
|
14
|
+
const button = await within(canvasElement).findByRole('button')
|
|
15
|
+
if (isClickDisabled) {
|
|
16
|
+
await expect(button).not.toBeClicked()
|
|
17
|
+
} else {
|
|
18
|
+
await expect(button).toBeClicked()
|
|
19
|
+
}
|
|
20
|
+
expect(button).toHaveClass('vv-button')
|
|
21
|
+
if (className) {
|
|
22
|
+
expect(button).toHaveClass(className)
|
|
23
|
+
}
|
|
24
|
+
await expect(button).toHaveNoViolations()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function testButtonWithBadge({ canvasElement }: PlayAttributes) {
|
|
28
|
+
const button = await within(canvasElement).findByRole('button')
|
|
29
|
+
expect(button.innerHTML).toContain('vv-badge')
|
|
30
|
+
await testButton({ canvasElement })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function testButtonWithIconLeft({
|
|
34
|
+
canvasElement
|
|
35
|
+
}: PlayAttributes) {
|
|
36
|
+
const button = await within(canvasElement).findByRole('button')
|
|
37
|
+
expect(button.innerHTML).toContain('vv-icon')
|
|
38
|
+
await testButton({ canvasElement })
|
|
39
|
+
}
|
|
40
|
+
export async function testButtonWithIconOnly({
|
|
41
|
+
canvasElement
|
|
42
|
+
}: PlayAttributes) {
|
|
43
|
+
const button = await within(canvasElement).findByRole('button')
|
|
44
|
+
expect(button.classList).toContain('vv-button--icon-only')
|
|
45
|
+
await testButton({ canvasElement })
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function testButtonLink(
|
|
49
|
+
{ canvasElement }: PlayAttributes,
|
|
50
|
+
{ isClickDisabled = false, className = null }: ButtonConfig = {}
|
|
51
|
+
) {
|
|
52
|
+
const button = await within(canvasElement).findByRole('button')
|
|
53
|
+
await testButton({ canvasElement }, { isClickDisabled, className })
|
|
54
|
+
expect(button).toHaveProperty('href')
|
|
55
|
+
expect(button).toHaveProperty('target')
|
|
56
|
+
await testButton({ canvasElement })
|
|
57
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
3
|
import VvBadge from '../../components/VvBadge/VvBadge.vue'
|
|
4
|
+
import { testButtonWithBadge } from './Button.test'
|
|
4
5
|
|
|
5
6
|
<Meta title="Components/Button/badge" />
|
|
6
7
|
|
|
@@ -9,7 +10,7 @@ import VvBadge from '../../components/VvBadge/VvBadge.vue'
|
|
|
9
10
|
Stories of `VvButton` with `badge`.
|
|
10
11
|
|
|
11
12
|
<Canvas>
|
|
12
|
-
<Story name="badge">
|
|
13
|
+
<Story name="badge" play={testButtonWithBadge}>
|
|
13
14
|
{() => {
|
|
14
15
|
return {
|
|
15
16
|
components: { VvButton, VvBadge },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
|
-
import {
|
|
3
|
+
import { testButtonWithIconLeft, testButtonWithIconOnly } from './Button.test'
|
|
4
4
|
|
|
5
5
|
<Meta title="Components/Button/Props/icon" />
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Stories of `VvButton` with `icon`.
|
|
|
13
13
|
Let's define a story for our text `icon` button.
|
|
14
14
|
|
|
15
15
|
<Canvas>
|
|
16
|
-
<Story name="icon-left" play={
|
|
16
|
+
<Story name="icon-left" play={testButtonWithIconLeft}>
|
|
17
17
|
{() => {
|
|
18
18
|
return {
|
|
19
19
|
components: { VvButton },
|
|
@@ -30,15 +30,7 @@ Let's define a story for our text `icon` button.
|
|
|
30
30
|
Let's define a story for our `icon` only button.
|
|
31
31
|
|
|
32
32
|
<Canvas>
|
|
33
|
-
<Story
|
|
34
|
-
name="icon-only"
|
|
35
|
-
play={(ctx) =>
|
|
36
|
-
buttonTest({
|
|
37
|
-
...ctx,
|
|
38
|
-
functions: [classTest],
|
|
39
|
-
className: 'icon-only'
|
|
40
|
-
})
|
|
41
|
-
}>
|
|
33
|
+
<Story name="icon-only" play={testButtonWithIconOnly}>
|
|
42
34
|
{() => {
|
|
43
35
|
return {
|
|
44
36
|
components: { VvButton },
|
|
@@ -2,6 +2,7 @@ import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
3
|
import { within, userEvent } from '@storybook/testing-library'
|
|
4
4
|
import { buttonTest, classTest } from './test.js'
|
|
5
|
+
import { testButton } from './Button.test'
|
|
5
6
|
|
|
6
7
|
<Meta title="Components/Button/Props/icon-position" />
|
|
7
8
|
|
|
@@ -14,7 +15,7 @@ Stories of `VvButton` with `icon`.
|
|
|
14
15
|
Let's define a story for our text `icon` button.
|
|
15
16
|
|
|
16
17
|
<Canvas>
|
|
17
|
-
<Story name="icon-left" play={
|
|
18
|
+
<Story name="icon-left" play={testButton}>
|
|
18
19
|
{() => {
|
|
19
20
|
return {
|
|
20
21
|
components: { VvButton },
|
|
@@ -33,13 +34,11 @@ Let's define a story for our right `icon` button.
|
|
|
33
34
|
<Canvas>
|
|
34
35
|
<Story
|
|
35
36
|
name="icon-right"
|
|
36
|
-
play={(ctx) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
functions: [classTest],
|
|
40
|
-
className: 'reverse'
|
|
37
|
+
play={async (ctx) => {
|
|
38
|
+
testButton(ctx, {
|
|
39
|
+
className: 'vv-button--reverse'
|
|
41
40
|
})
|
|
42
|
-
}>
|
|
41
|
+
}}>
|
|
43
42
|
{() => {
|
|
44
43
|
return {
|
|
45
44
|
components: { VvButton },
|
|
@@ -59,7 +58,13 @@ Let's define a story for our right `icon` button.
|
|
|
59
58
|
Let's define a story for our top `icon` button.
|
|
60
59
|
|
|
61
60
|
<Canvas>
|
|
62
|
-
<Story
|
|
61
|
+
<Story
|
|
62
|
+
name="icon-top"
|
|
63
|
+
play={async (ctx) => {
|
|
64
|
+
testButton(ctx, {
|
|
65
|
+
className: 'vv-button--column'
|
|
66
|
+
})
|
|
67
|
+
}}>
|
|
63
68
|
{() => {
|
|
64
69
|
return {
|
|
65
70
|
components: { VvButton },
|
|
@@ -81,13 +86,11 @@ Let's define a story for our bottom `icon` button.
|
|
|
81
86
|
<Canvas>
|
|
82
87
|
<Story
|
|
83
88
|
name="icon-bottom"
|
|
84
|
-
play={(ctx) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
functions: [classTest],
|
|
88
|
-
className: 'reverse'
|
|
89
|
+
play={async (ctx) => {
|
|
90
|
+
testButton(ctx, {
|
|
91
|
+
className: ['vv-button--column', 'vv-button--reverse']
|
|
89
92
|
})
|
|
90
|
-
}>
|
|
93
|
+
}}>
|
|
91
94
|
{() => {
|
|
92
95
|
return {
|
|
93
96
|
components: { VvButton },
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
buttonTest,
|
|
6
|
-
disableTest,
|
|
7
|
-
cssTest,
|
|
8
|
-
propertyTest,
|
|
9
|
-
classTest
|
|
10
|
-
} from './test.js'
|
|
3
|
+
import { testButtonLink } from './Button.test'
|
|
11
4
|
|
|
12
5
|
<Meta title="Components/Button/Link" />
|
|
13
6
|
|
|
@@ -20,12 +13,9 @@ Stories of `VvButton` with `link`.
|
|
|
20
13
|
<Canvas>
|
|
21
14
|
<Story
|
|
22
15
|
name="link-text"
|
|
23
|
-
play={(ctx) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
functions: [propertyTest, classTest],
|
|
27
|
-
properties: ['target', 'href'],
|
|
28
|
-
className: 'text'
|
|
16
|
+
play={async (ctx) =>
|
|
17
|
+
testButtonLink(ctx, {
|
|
18
|
+
className: 'vv-button--text'
|
|
29
19
|
})
|
|
30
20
|
}>
|
|
31
21
|
{() => {
|
|
@@ -48,11 +38,9 @@ Stories of `VvButton` with `link`.
|
|
|
48
38
|
<Story
|
|
49
39
|
name="link-text-disabled"
|
|
50
40
|
play={(ctx) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
cssString: 'cursor: not-allowed',
|
|
55
|
-
className: 'text'
|
|
41
|
+
testButtonLink(ctx, {
|
|
42
|
+
isClickDisabled: true,
|
|
43
|
+
className: 'vv-button--disabled'
|
|
56
44
|
})
|
|
57
45
|
}>
|
|
58
46
|
{() => {
|
|
@@ -72,15 +60,7 @@ Stories of `VvButton` with `link`.
|
|
|
72
60
|
## Button link
|
|
73
61
|
|
|
74
62
|
<Canvas>
|
|
75
|
-
<Story
|
|
76
|
-
name="button-link"
|
|
77
|
-
play={(ctx) =>
|
|
78
|
-
buttonTest({
|
|
79
|
-
...ctx,
|
|
80
|
-
functions: [propertyTest],
|
|
81
|
-
properties: ['target', 'href']
|
|
82
|
-
})
|
|
83
|
-
}>
|
|
63
|
+
<Story name="button-link" play={(ctx) => testButtonLink(ctx)}>
|
|
84
64
|
{() => {
|
|
85
65
|
return {
|
|
86
66
|
components: { VvButton },
|
|
@@ -107,10 +87,9 @@ Stories of `VvButton` with `link`.
|
|
|
107
87
|
<Story
|
|
108
88
|
name="button-link-disabled"
|
|
109
89
|
play={(ctx) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
cssString: 'cursor: not-allowed'
|
|
90
|
+
testButtonLink(ctx, {
|
|
91
|
+
isClickDisabled: true,
|
|
92
|
+
className: 'vv-button--disabled'
|
|
114
93
|
})
|
|
115
94
|
}>
|
|
116
95
|
{() => {
|
|
@@ -135,18 +114,8 @@ export const Template = () => ({
|
|
|
135
114
|
})
|
|
136
115
|
|
|
137
116
|
<Canvas>
|
|
138
|
-
<Story
|
|
139
|
-
|
|
140
|
-
args={{}}
|
|
141
|
-
play={(ctx) =>
|
|
142
|
-
buttonTest({
|
|
143
|
-
...ctx,
|
|
144
|
-
functions: [propertyTest, classTest],
|
|
145
|
-
properties: ['href'],
|
|
146
|
-
className: 'text'
|
|
147
|
-
})
|
|
148
|
-
}>
|
|
149
|
-
{Template.bind()}
|
|
117
|
+
<Story name="router-link" args={{}} play={(ctx) => testButtonLink(ctx)}>
|
|
118
|
+
{RouterLinkStory}
|
|
150
119
|
</Story>
|
|
151
120
|
</Canvas>
|
|
152
121
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
|
+
import { testButton } from './Button.test'
|
|
3
4
|
|
|
4
5
|
<Meta title="Components/Button/Props/loading" />
|
|
5
6
|
|
|
@@ -12,7 +13,13 @@ Stories of `VvButton` with `loading`.
|
|
|
12
13
|
Let's define a story for our `loading` button.
|
|
13
14
|
|
|
14
15
|
<Canvas>
|
|
15
|
-
<Story
|
|
16
|
+
<Story
|
|
17
|
+
name="loading"
|
|
18
|
+
play={async (ctx) => {
|
|
19
|
+
testButton(ctx, {
|
|
20
|
+
isClickDisabled: true
|
|
21
|
+
})
|
|
22
|
+
}}>
|
|
16
23
|
{() => {
|
|
17
24
|
return {
|
|
18
25
|
components: { VvButton },
|
|
@@ -29,7 +36,13 @@ Let's define a story for our `loading` button.
|
|
|
29
36
|
Let's define a story for `loading-icon`
|
|
30
37
|
|
|
31
38
|
<Canvas>
|
|
32
|
-
<Story
|
|
39
|
+
<Story
|
|
40
|
+
name="loading-icon"
|
|
41
|
+
play={async (ctx) => {
|
|
42
|
+
testButton(ctx, {
|
|
43
|
+
isClickDisabled: true
|
|
44
|
+
})
|
|
45
|
+
}}>
|
|
33
46
|
{() => {
|
|
34
47
|
return {
|
|
35
48
|
components: { VvButton },
|
|
@@ -46,7 +59,13 @@ Let's define a story for `loading-icon`
|
|
|
46
59
|
Let's define a story for `loading-label`
|
|
47
60
|
|
|
48
61
|
<Canvas>
|
|
49
|
-
<Story
|
|
62
|
+
<Story
|
|
63
|
+
name="loading-label"
|
|
64
|
+
play={async (ctx) => {
|
|
65
|
+
testButton(ctx, {
|
|
66
|
+
isClickDisabled: true
|
|
67
|
+
})
|
|
68
|
+
}}>
|
|
50
69
|
{() => {
|
|
51
70
|
return {
|
|
52
71
|
components: { VvButton },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
|
-
import {
|
|
3
|
+
import { testButton } from './Button.test'
|
|
4
4
|
|
|
5
5
|
<Meta title="Components/Button/Props/modifiers" />
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ Stories of `VvButton` `modifiers`.
|
|
|
13
13
|
Let's define a story for our `default` button:
|
|
14
14
|
|
|
15
15
|
<Canvas>
|
|
16
|
-
<Story name="default" play={
|
|
16
|
+
<Story name="default" play={testButton}>
|
|
17
17
|
{() => {
|
|
18
18
|
return {
|
|
19
19
|
components: { VvButton },
|
|
@@ -32,13 +32,11 @@ Let's define a story for our `primary` button:
|
|
|
32
32
|
<Canvas>
|
|
33
33
|
<Story
|
|
34
34
|
name="primary"
|
|
35
|
-
play={(ctx) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
functions: [classTest],
|
|
39
|
-
className: 'primary'
|
|
35
|
+
play={async (ctx) => {
|
|
36
|
+
testButton(ctx, {
|
|
37
|
+
className: ['vv-button--primary']
|
|
40
38
|
})
|
|
41
|
-
}>
|
|
39
|
+
}}>
|
|
42
40
|
{() => {
|
|
43
41
|
return {
|
|
44
42
|
components: { VvButton },
|
|
@@ -55,13 +53,11 @@ Let's define a story for our `secondary` button:
|
|
|
55
53
|
<Canvas>
|
|
56
54
|
<Story
|
|
57
55
|
name="secondary"
|
|
58
|
-
play={(ctx) =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
functions: [classTest],
|
|
62
|
-
className: 'secondary'
|
|
56
|
+
play={async (ctx) => {
|
|
57
|
+
testButton(ctx, {
|
|
58
|
+
className: 'vv-button--secondary'
|
|
63
59
|
})
|
|
64
|
-
}>
|
|
60
|
+
}}>
|
|
65
61
|
{() => {
|
|
66
62
|
return {
|
|
67
63
|
components: { VvButton },
|
|
@@ -78,13 +74,11 @@ Let's define a story for our `danger` button:
|
|
|
78
74
|
<Canvas>
|
|
79
75
|
<Story
|
|
80
76
|
name="danger"
|
|
81
|
-
play={(ctx) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
functions: [classTest],
|
|
85
|
-
className: 'danger'
|
|
77
|
+
play={async (ctx) => {
|
|
78
|
+
testButton(ctx, {
|
|
79
|
+
className: 'vv-button--danger'
|
|
86
80
|
})
|
|
87
|
-
}>
|
|
81
|
+
}}>
|
|
88
82
|
{() => {
|
|
89
83
|
return {
|
|
90
84
|
components: { VvButton },
|
|
@@ -101,13 +95,11 @@ Let's define a story for our `ghost` button:
|
|
|
101
95
|
<Canvas>
|
|
102
96
|
<Story
|
|
103
97
|
name="ghost"
|
|
104
|
-
play={(ctx) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
functions: [classTest],
|
|
108
|
-
className: 'ghost'
|
|
98
|
+
play={async (ctx) => {
|
|
99
|
+
testButton(ctx, {
|
|
100
|
+
className: 'vv-button--ghost'
|
|
109
101
|
})
|
|
110
|
-
}>
|
|
102
|
+
}}>
|
|
111
103
|
{() => {
|
|
112
104
|
return {
|
|
113
105
|
components: { VvButton },
|
|
@@ -124,13 +116,11 @@ Let's define a story for our `text` button:
|
|
|
124
116
|
<Canvas>
|
|
125
117
|
<Story
|
|
126
118
|
name="text"
|
|
127
|
-
play={(ctx) =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
functions: [classTest],
|
|
131
|
-
className: 'text'
|
|
119
|
+
play={async (ctx) => {
|
|
120
|
+
testButton(ctx, {
|
|
121
|
+
className: 'vv-button--text'
|
|
132
122
|
})
|
|
133
|
-
}>
|
|
123
|
+
}}>
|
|
134
124
|
{() => {
|
|
135
125
|
return {
|
|
136
126
|
components: { VvButton },
|
|
@@ -147,13 +137,11 @@ Let's define a story for our `static-light` button:
|
|
|
147
137
|
<Canvas>
|
|
148
138
|
<Story
|
|
149
139
|
name="static-light"
|
|
150
|
-
play={(ctx) =>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
functions: [classTest],
|
|
154
|
-
className: 'static-light'
|
|
140
|
+
play={async (ctx) => {
|
|
141
|
+
testButton(ctx, {
|
|
142
|
+
className: 'vv-button--static-light'
|
|
155
143
|
})
|
|
156
|
-
}>
|
|
144
|
+
}}>
|
|
157
145
|
{() => {
|
|
158
146
|
return {
|
|
159
147
|
components: { VvButton },
|
|
@@ -177,13 +165,11 @@ Let's define a story for our `static-dark` button:
|
|
|
177
165
|
<Canvas>
|
|
178
166
|
<Story
|
|
179
167
|
name="static-dark"
|
|
180
|
-
play={(ctx) =>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
functions: [classTest],
|
|
184
|
-
className: 'static-dark'
|
|
168
|
+
play={async (ctx) => {
|
|
169
|
+
testButton(ctx, {
|
|
170
|
+
className: 'vv-button--static-dark'
|
|
185
171
|
})
|
|
186
|
-
}>
|
|
172
|
+
}}>
|
|
187
173
|
{() => {
|
|
188
174
|
return {
|
|
189
175
|
components: { VvButton },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Canvas, Meta, Story, Source } from '@storybook/addon-docs'
|
|
2
2
|
import VvButton from '../../components/VvButton/VvButton.vue'
|
|
3
|
-
import { within, userEvent } from '@storybook/testing-library'
|
|
4
3
|
import { buttonTest, classTest, cssTest, disableTest } from './test.js'
|
|
4
|
+
import { testButton } from './Button.test'
|
|
5
5
|
|
|
6
6
|
<Meta title="Components/Button/Variant" />
|
|
7
7
|
|
|
@@ -17,14 +17,11 @@ Create block level button that span the full width of a parent.
|
|
|
17
17
|
<Canvas>
|
|
18
18
|
<Story
|
|
19
19
|
name="block"
|
|
20
|
-
play={(ctx) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
functions: [classTest, cssTest],
|
|
24
|
-
className: 'block',
|
|
25
|
-
cssString: 'display: block'
|
|
20
|
+
play={async (ctx) => {
|
|
21
|
+
testButton(ctx, {
|
|
22
|
+
className: `vv-button--block`
|
|
26
23
|
})
|
|
27
|
-
}>
|
|
24
|
+
}}>
|
|
28
25
|
{() => {
|
|
29
26
|
return {
|
|
30
27
|
components: { VvButton },
|
|
@@ -43,14 +40,11 @@ Let's define a story for our `rounded` button:
|
|
|
43
40
|
<Canvas>
|
|
44
41
|
<Story
|
|
45
42
|
name="rounded"
|
|
46
|
-
play={(ctx) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
functions: [classTest, cssTest],
|
|
50
|
-
className: 'rounded',
|
|
51
|
-
cssString: 'border-radius: 9999px'
|
|
43
|
+
play={async (ctx) => {
|
|
44
|
+
testButton(ctx, {
|
|
45
|
+
className: `vv-button--rounded`
|
|
52
46
|
})
|
|
53
|
-
}>
|
|
47
|
+
}}>
|
|
54
48
|
{() => {
|
|
55
49
|
return {
|
|
56
50
|
components: { VvButton },
|
|
@@ -69,13 +63,11 @@ Let's define a story for our `full-bleed` button:
|
|
|
69
63
|
<Canvas>
|
|
70
64
|
<Story
|
|
71
65
|
name="full-bleed"
|
|
72
|
-
play={(ctx) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
functions: [classTest],
|
|
76
|
-
className: 'full-bleed'
|
|
66
|
+
play={async (ctx) => {
|
|
67
|
+
testButton(ctx, {
|
|
68
|
+
className: `vv-button--full-bleed`
|
|
77
69
|
})
|
|
78
|
-
}>
|
|
70
|
+
}}>
|
|
79
71
|
{() => {
|
|
80
72
|
return {
|
|
81
73
|
components: { VvButton },
|
|
@@ -101,13 +93,11 @@ Let's define a story for our `disabled` button.
|
|
|
101
93
|
<Canvas>
|
|
102
94
|
<Story
|
|
103
95
|
name="disabled"
|
|
104
|
-
play={(ctx) =>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
functions: [cssTest, disableTest],
|
|
108
|
-
cssString: 'cursor: not-allowed'
|
|
96
|
+
play={async (ctx) => {
|
|
97
|
+
testButton(ctx, {
|
|
98
|
+
isClickDisabled: true
|
|
109
99
|
})
|
|
110
|
-
}>
|
|
100
|
+
}}>
|
|
111
101
|
{() => {
|
|
112
102
|
return {
|
|
113
103
|
components: { VvButton },
|
|
@@ -126,13 +116,11 @@ Let's define a story for our `active` button.
|
|
|
126
116
|
<Canvas>
|
|
127
117
|
<Story
|
|
128
118
|
name="active"
|
|
129
|
-
play={(ctx) =>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
functions: [classTest],
|
|
133
|
-
className: 'active'
|
|
119
|
+
play={async (ctx) => {
|
|
120
|
+
testButton(ctx, {
|
|
121
|
+
className: 'vv-button--active'
|
|
134
122
|
})
|
|
135
|
-
}>
|
|
123
|
+
}}>
|
|
136
124
|
{() => {
|
|
137
125
|
return {
|
|
138
126
|
components: { VvButton },
|
|
@@ -151,13 +139,11 @@ Let's define a story for our `action` button.
|
|
|
151
139
|
<Canvas>
|
|
152
140
|
<Story
|
|
153
141
|
name="action"
|
|
154
|
-
play={(ctx) =>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
functions: [classTest],
|
|
158
|
-
className: 'action'
|
|
142
|
+
play={async (ctx) => {
|
|
143
|
+
testButton(ctx, {
|
|
144
|
+
className: 'vv-button--action'
|
|
159
145
|
})
|
|
160
|
-
}>
|
|
146
|
+
}}>
|
|
161
147
|
{() => {
|
|
162
148
|
return {
|
|
163
149
|
components: { VvButton },
|
|
@@ -176,13 +162,11 @@ Let's define a story for our `action` `selected` button.
|
|
|
176
162
|
<Canvas>
|
|
177
163
|
<Story
|
|
178
164
|
name="selected"
|
|
179
|
-
play={(ctx) =>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
functions: [classTest],
|
|
183
|
-
className: 'selected'
|
|
165
|
+
play={async (ctx) => {
|
|
166
|
+
testButton(ctx, {
|
|
167
|
+
className: 'vv-button--selected'
|
|
184
168
|
})
|
|
185
|
-
}>
|
|
169
|
+
}}>
|
|
186
170
|
{() => {
|
|
187
171
|
return {
|
|
188
172
|
components: { VvButton },
|
|
@@ -201,13 +185,11 @@ Let's define a story for our `action-quiet` button.
|
|
|
201
185
|
<Canvas>
|
|
202
186
|
<Story
|
|
203
187
|
name="action-quiet"
|
|
204
|
-
play={(ctx) =>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
functions: [classTest],
|
|
208
|
-
className: 'selected'
|
|
188
|
+
play={async (ctx) => {
|
|
189
|
+
testButton(ctx, {
|
|
190
|
+
className: 'vv-button--action-quiet'
|
|
209
191
|
})
|
|
210
|
-
}>
|
|
192
|
+
}}>
|
|
211
193
|
{() => {
|
|
212
194
|
return {
|
|
213
195
|
components: { VvButton },
|
|
@@ -3,7 +3,8 @@ import { Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
|
3
3
|
<Meta title="Volver ui-vue" />
|
|
4
4
|
|
|
5
5
|
<div class="flex justify-center pb-xl">
|
|
6
|
-
<img src="https://raw.githubusercontent.com/volverjs/style/
|
|
6
|
+
{/* <img src="https://raw.githubusercontent.com/volverjs/style/main/src/assets/volverjs.svg" /> */}
|
|
7
|
+
<img src="volverjs-beta.png" />
|
|
7
8
|
</div>
|
|
8
9
|
|
|
9
10
|
# @volverjs/ui-vue
|