@vcita/design-system 0.3.13 → 0.3.14
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/CHANGELOG.MD +10 -0
- package/config/locales/ds.en.yml +2 -0
- package/dist/@vcita/design-system.esm.js +1082 -707
- package/dist/@vcita/design-system.min.js +1 -1
- package/dist/@vcita/design-system.ssr.js +953 -614
- package/init/SvgIcons.js +1 -0
- package/package.json +1 -1
- package/src/components/VcAvatar/VcAvatar.stories.js +13 -2
- package/src/components/VcAvatar/VcAvatar.vue +56 -20
- package/src/components/VcBanner/VcBanner.stories.js +11 -0
- package/src/components/VcBanner/VcBanner.vue +23 -18
- package/src/components/VcCheckbox/VcCheckbox.stories.js +2 -0
- package/src/components/VcCheckbox/VcCheckbox.vue +19 -14
- package/src/components/VcEmptyState/VcEmptyState.stories.js +18 -9
- package/src/components/VcEmptyState/VcEmptyState.vue +24 -15
- package/src/components/VcExpansionCard/VcExpansionCard.stories.js +35 -2
- package/src/components/VcExpansionCard/VcExpansionCard.vue +63 -53
- package/src/components/VcIconWithTooltip/VcIconWithTooltip.spec.js +1 -1
- package/src/components/VcImage/VcImage.spec.js +46 -0
- package/src/components/VcImage/VcImage.stories.js +34 -0
- package/src/components/VcImage/VcImage.vue +40 -0
- package/src/components/VcTooltip/VcTooltip.stories.js +3 -1
- package/src/components/VcTooltip/VcTooltip.vue +5 -0
- package/src/components/index.js +3 -0
- package/src/components/listBox/VcChecklistItem/VcChecklistItem.spec.js +93 -0
- package/src/components/listBox/VcChecklistItem/VcChecklistItem.stories.js +56 -0
- package/src/components/listBox/VcChecklistItem/VcChecklistItem.vue +112 -0
- package/src/components/listBox/VcListbox/VcListbox.spec.js +131 -0
- package/src/components/listBox/VcListbox/VcListbox.stories.js +79 -0
- package/src/components/listBox/VcListbox/VcListbox.vue +141 -0
- package/src/components/modal/VcNoticeModal/VcNoticeModal.stories.js +20 -19
- package/src/components/modal/VcNoticeModal/VcNoticeModal.vue +17 -6
- package/src/components/wizard/VcStepsBar/VcStepsBar.vue +26 -24
- package/src/components/wizard/VcWizard/VcWizard.spec.js +1 -1
- package/src/components/wizard/VcWizard/VcWizard.stories.js +1 -0
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div id="container" class="expansionCard"
|
|
2
|
+
<div id="container" class="expansionCard" :class="{'is-active': value}" :data-qa="dataQa">
|
|
3
3
|
<v-container fluid>
|
|
4
|
-
<div class="d-flex flex-wrap justify-space-between align-center"
|
|
5
|
-
<div class="justify-start d-flex align-center"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
<div class="expansionCardTitle d-flex flex-wrap justify-space-between align-center">
|
|
5
|
+
<div class="logo-area justify-start d-flex align-center">
|
|
6
|
+
<VcImage class="VcLogoImage" :image="fromLogo"/>
|
|
7
|
+
<VcIcon size="12">$chevron_left</VcIcon>
|
|
8
|
+
<VcImage class="VcLogoImage" :image="toLogo"/>
|
|
9
9
|
</div>
|
|
10
10
|
<div class="d-flex justify-end" style="width:initial;" :class="{'order-2':$vuetify.breakpoint.mdAndUp}">
|
|
11
11
|
<VcSwitch
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:ripple="false"
|
|
14
|
+
icon
|
|
15
|
+
:value="value"
|
|
16
|
+
color="secondary"
|
|
17
|
+
@input="val => $emit('input', Boolean(val))"
|
|
18
18
|
>
|
|
19
19
|
</VcSwitch>
|
|
20
20
|
</div>
|
|
21
21
|
<div class="d-flex flex-wrap ec-text"
|
|
22
|
-
|
|
22
|
+
:class="{
|
|
23
23
|
'order-1 justify-start':$vuetify.breakpoint.mdAndUp,
|
|
24
24
|
'full-width':!$vuetify.breakpoint.mdAndUp
|
|
25
25
|
}">
|
|
26
|
-
<div
|
|
27
|
-
class="ec-title"
|
|
28
|
-
v-html="title"
|
|
29
|
-
>
|
|
26
|
+
<div class="ec-title" v-html="title">
|
|
30
27
|
</div>
|
|
31
28
|
</div>
|
|
32
|
-
|
|
29
|
+
|
|
33
30
|
</div>
|
|
34
31
|
<slot name="content" v-if="value"></slot>
|
|
35
32
|
</v-container>
|
|
@@ -38,8 +35,10 @@
|
|
|
38
35
|
<script>
|
|
39
36
|
import VcIcon from '../VcIcon/VcIcon.vue'
|
|
40
37
|
import VcSwitch from '../VcSwitch/VcSwitch.vue';
|
|
38
|
+
import VcImage from "@/components/VcImage/VcImage.vue";
|
|
39
|
+
|
|
41
40
|
export default {
|
|
42
|
-
components: { VcIcon, VcSwitch
|
|
41
|
+
components: {VcImage, VcIcon, VcSwitch},
|
|
43
42
|
name: 'VcExpansionCard',
|
|
44
43
|
props: {
|
|
45
44
|
disabled: {
|
|
@@ -47,22 +46,22 @@ export default {
|
|
|
47
46
|
default: false,
|
|
48
47
|
},
|
|
49
48
|
value: {
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
52
51
|
},
|
|
53
52
|
toLogo: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
default: "",
|
|
57
56
|
},
|
|
58
57
|
fromLogo: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
type: String,
|
|
59
|
+
required: false,
|
|
60
|
+
default: "",
|
|
62
61
|
},
|
|
63
62
|
title: {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
type: String,
|
|
64
|
+
required: false,
|
|
66
65
|
},
|
|
67
66
|
dataQa: {
|
|
68
67
|
type: String,
|
|
@@ -72,46 +71,57 @@ export default {
|
|
|
72
71
|
};
|
|
73
72
|
</script>
|
|
74
73
|
|
|
75
|
-
<style lang="scss">
|
|
74
|
+
<style lang="scss" scoped>
|
|
76
75
|
|
|
77
|
-
.expansionCard{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
.expansionCard {
|
|
77
|
+
border-radius: 6px;
|
|
78
|
+
border: 1px solid;
|
|
79
|
+
border-color: var(--gray-darken-1) !important;
|
|
80
|
+
margin: var(--size-value5) 0;
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
border-color: var(--v-secondary-base)!important;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
& .ec-title {
|
|
88
|
-
font-size: var(--font-size-small2);
|
|
89
|
-
line-height: var(--size-value6);
|
|
90
|
-
margin: var(--size-value3) 0px;
|
|
91
|
-
}
|
|
82
|
+
&.is-active {
|
|
83
|
+
border-color: var(--v-secondary-base) !important;
|
|
84
|
+
}
|
|
92
85
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
& .ec-title {
|
|
87
|
+
font-size: var(--font-size-small2);
|
|
88
|
+
line-height: var(--size-value6);
|
|
89
|
+
margin: var(--size-value3) 0px;
|
|
90
|
+
}
|
|
96
91
|
|
|
97
|
-
|
|
92
|
+
& .VcLogoImage {
|
|
98
93
|
width: var(--size-value7);
|
|
99
|
-
height:var(--size-value7);
|
|
94
|
+
height: var(--size-value7);
|
|
100
95
|
margin: 0px 6px;
|
|
101
96
|
border: 1px solid var(--gray-lighten-1);
|
|
102
97
|
box-sizing: border-box;
|
|
103
98
|
border-radius: 6px;
|
|
104
99
|
}
|
|
105
100
|
|
|
106
|
-
& .ec-text{
|
|
107
|
-
&.full-width{
|
|
101
|
+
& .ec-text {
|
|
102
|
+
&.full-width {
|
|
108
103
|
width: 100%;
|
|
109
104
|
}
|
|
110
105
|
|
|
111
|
-
&.order-1{
|
|
106
|
+
&.order-1 {
|
|
112
107
|
flex-grow: 1;
|
|
113
108
|
}
|
|
114
109
|
}
|
|
115
|
-
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.expansionCardTitle {
|
|
113
|
+
min-width: 100%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.logo-area {
|
|
117
|
+
min-width: 92px;
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
120
|
+
|
|
121
|
+
<style lang="scss">
|
|
122
|
+
.expansionCard {
|
|
123
|
+
& .vc-chevron-left {
|
|
124
|
+
fill: var(--gray-darken-1) !important;
|
|
125
|
+
}
|
|
116
126
|
}
|
|
117
127
|
</style>
|
|
@@ -129,7 +129,7 @@ describe("VcIconWithTooltip.vue", () => {
|
|
|
129
129
|
expect(filledIcon).toBeVisible()
|
|
130
130
|
expect(queryByText('$attention')).toBeNull()
|
|
131
131
|
expect(tooltipContent).toBeVisible()
|
|
132
|
-
}, {timeout:
|
|
132
|
+
}, {timeout: 1000})
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
it("default icon", async () => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcImage from "./VcImage.vue";
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import {render} from "@testing-library/vue";
|
|
5
|
+
import init from "../../../testing-library.config";
|
|
6
|
+
|
|
7
|
+
init();
|
|
8
|
+
|
|
9
|
+
describe("VcImage.vue", () => {
|
|
10
|
+
|
|
11
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
12
|
+
const root = document.createElement('div')
|
|
13
|
+
root.setAttribute('data-app', 'true')
|
|
14
|
+
|
|
15
|
+
return render(
|
|
16
|
+
component,
|
|
17
|
+
{
|
|
18
|
+
container: document.body.appendChild(root),
|
|
19
|
+
// for Vuetify components that use the vuetify instance property
|
|
20
|
+
vuetify: new Vuetify(),
|
|
21
|
+
...options,
|
|
22
|
+
mocks: {},
|
|
23
|
+
},
|
|
24
|
+
callback,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
it("mounts", async () => {
|
|
29
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
30
|
+
const {container, getByTestId, debug} = renderWithVuetify(VcImage, {
|
|
31
|
+
props: {
|
|
32
|
+
image: require('@/stories/assets/upgrade.svg'),
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
37
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
38
|
+
|
|
39
|
+
// Make sure the component has the data-qa attribute
|
|
40
|
+
const component = getByTestId('VcImage');
|
|
41
|
+
expect(component).toBeInTheDocument();
|
|
42
|
+
|
|
43
|
+
debug();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import VcImageCmp from './VcImage';
|
|
2
|
+
|
|
3
|
+
const Template = (args, {argTypes}) => ({
|
|
4
|
+
components: {VcImage: VcImageCmp},
|
|
5
|
+
props: Object.keys(argTypes),
|
|
6
|
+
template: `
|
|
7
|
+
<div>
|
|
8
|
+
The objective of this component is to handle situations when the image might be a string or a component
|
|
9
|
+
<VcImage :image="image"/>
|
|
10
|
+
</div>`,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const Playground = Template.bind({});
|
|
14
|
+
|
|
15
|
+
// Set default values
|
|
16
|
+
Playground.args = {
|
|
17
|
+
image: require('@/stories/assets/upgrade.svg'),
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: 'content display / VcImage', // This will control the story sidebar position
|
|
22
|
+
id: 'VcImage', // This will be the link to this component
|
|
23
|
+
component: VcImageCmp,
|
|
24
|
+
parameters: {
|
|
25
|
+
design: {
|
|
26
|
+
type: 'figma',
|
|
27
|
+
url: 'https://www.figma.com',
|
|
28
|
+
},
|
|
29
|
+
status: {
|
|
30
|
+
type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
31
|
+
url: 'http://www.url.com/status', // will make the tag a link
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="VcBannerImage d-none d-md-block" :data-qa="dataQa">
|
|
3
|
+
<img v-if="image && typeof image === 'string'" class="image" :src="image" >
|
|
4
|
+
<component v-else class="VcBannerImage d-none d-md-block" :is="image"/>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
name: "VcImage",
|
|
11
|
+
props: {
|
|
12
|
+
image: {
|
|
13
|
+
type: [String, Object],
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
dataQa: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'VcImage'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style lang="scss" scoped>
|
|
25
|
+
|
|
26
|
+
.VcBannerImage {
|
|
27
|
+
height: 100%;
|
|
28
|
+
|
|
29
|
+
::v-deep img {
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
::v-deep svg {
|
|
35
|
+
max-width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
</style>
|
|
@@ -27,6 +27,7 @@ const GeneralTemplate = (args, {argTypes}) => ({
|
|
|
27
27
|
:nudge-right="nudgeRight"
|
|
28
28
|
:flavor="flavor"
|
|
29
29
|
:dark="dark"
|
|
30
|
+
:disabled="disabled"
|
|
30
31
|
:data-qa="dataQa">
|
|
31
32
|
<template>
|
|
32
33
|
<v-icon>$info</v-icon>
|
|
@@ -47,7 +48,8 @@ Playground.args = {
|
|
|
47
48
|
nudgeRight: 0,
|
|
48
49
|
dataQa: 'vcita-tooltip',
|
|
49
50
|
flavor: 'information',
|
|
50
|
-
dark: true
|
|
51
|
+
dark: true,
|
|
52
|
+
disabled: false
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
const ButtonTemplate = (args, {argTypes}) => ({
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
:bottom="bottom"
|
|
9
9
|
:nudge-left="nudgeLeft"
|
|
10
10
|
:nudge-right="nudgeRight"
|
|
11
|
+
:disabled="disabled"
|
|
11
12
|
:data-qa="dataQa">
|
|
12
13
|
|
|
13
14
|
<template v-slot:activator="{ on, attrs }">
|
|
@@ -82,6 +83,10 @@ export default {
|
|
|
82
83
|
type: Boolean,
|
|
83
84
|
default: false
|
|
84
85
|
},
|
|
86
|
+
disabled: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
85
90
|
dataQa: {
|
|
86
91
|
type: String,
|
|
87
92
|
default: 'vc-tooltip'
|
package/src/components/index.js
CHANGED
|
@@ -13,6 +13,8 @@ export {default as VcActions} from './VcActions/VcActions.vue';
|
|
|
13
13
|
export {default as VcStepsBar} from './wizard/VcStepsBar/VcStepsBar.vue';
|
|
14
14
|
export {default as VcMobileWizardProgress} from './wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue';
|
|
15
15
|
export {default as VcProgressCircular} from './VcProgressCircular/VcProgressCircular.vue';
|
|
16
|
+
export {default as VcChecklistItem} from './listBox/VcChecklistItem/VcChecklistItem.vue';
|
|
17
|
+
export {default as VcListbox} from './listBox/VcListbox/VcListbox.vue';
|
|
16
18
|
// export {default as VcAutoComplete} from './VcAutoComplete/VcAutoComplete.vue';
|
|
17
19
|
export {default as VcButton} from './VcButton/VcButton.vue';
|
|
18
20
|
export {default as VcButtonGroup} from './VcButtonGroup/VcButtonGroup.vue';
|
|
@@ -39,3 +41,4 @@ export {default as VcSvg} from './VcSvg/VcSvg.vue';
|
|
|
39
41
|
export {default as VcBanner} from './VcBanner/VcBanner.vue'
|
|
40
42
|
export {default as VcWizardCtaContainer} from './wizard/VcWizardCtaContainer/VcWizardCtaContainer.vue';
|
|
41
43
|
export {default as VcWizard} from './wizard/VcWizard/VcWizard.vue';
|
|
44
|
+
export {default as VcImage} from './VcImage/VcImage.vue';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcChecklistItem from "./VcChecklistItem.vue";
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import {render, waitFor} from "@testing-library/vue";
|
|
5
|
+
import init from "../../../../testing-library.config";
|
|
6
|
+
import {fireEvent} from "@testing-library/dom";
|
|
7
|
+
import userEvent from "@testing-library/user-event";
|
|
8
|
+
|
|
9
|
+
init();
|
|
10
|
+
|
|
11
|
+
describe("VcChecklistItem.vue", () => {
|
|
12
|
+
|
|
13
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
14
|
+
const root = document.createElement('div')
|
|
15
|
+
root.setAttribute('data-app', 'true')
|
|
16
|
+
|
|
17
|
+
return render(
|
|
18
|
+
component,
|
|
19
|
+
{
|
|
20
|
+
container: document.body.appendChild(root),
|
|
21
|
+
// for Vuetify components that use the vuetify instance property
|
|
22
|
+
vuetify: new Vuetify(),
|
|
23
|
+
...options,
|
|
24
|
+
mocks: {},
|
|
25
|
+
},
|
|
26
|
+
callback,
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
it("mounts with default settings", async () => {
|
|
31
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
32
|
+
const {container, queryByRole, getByTestId, emitted} = renderWithVuetify(VcChecklistItem, {
|
|
33
|
+
props: {
|
|
34
|
+
label: "Peter Parker"
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
39
|
+
|
|
40
|
+
const listObj = getByTestId('VcChecklistItem');
|
|
41
|
+
expect(listObj).toBeInTheDocument();
|
|
42
|
+
|
|
43
|
+
const checkbox = queryByRole('checkbox');
|
|
44
|
+
expect(checkbox).toBeInTheDocument();
|
|
45
|
+
|
|
46
|
+
await fireEvent.click(checkbox);
|
|
47
|
+
expect(emitted().change.length).toBe(1);
|
|
48
|
+
expect(emitted().change[0]).toStrictEqual([{"checked": true}]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("Has clickable avatar", async () => {
|
|
52
|
+
const {getByRole, getByTestId, emitted} = renderWithVuetify(VcChecklistItem, {
|
|
53
|
+
props: {
|
|
54
|
+
label: "Peter Parker",
|
|
55
|
+
avatar: {
|
|
56
|
+
path: "https://www.citypng.com/public/uploads/preview/-101609838369it1a5cyvuz.png"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const avatar = getByTestId('avatarImage')
|
|
62
|
+
expect(avatar).toBeInTheDocument();
|
|
63
|
+
await fireEvent.click(avatar);
|
|
64
|
+
|
|
65
|
+
const checkbox = getByRole('checkbox');
|
|
66
|
+
expect(checkbox).toBeInTheDocument();
|
|
67
|
+
expect(checkbox).toBeChecked();
|
|
68
|
+
expect(emitted().change.length).toBe(1);
|
|
69
|
+
|
|
70
|
+
await fireEvent.click(checkbox);
|
|
71
|
+
expect(checkbox).not.toBeChecked();
|
|
72
|
+
expect(emitted().change.length).toBe(2);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("Is disable", async() => {
|
|
76
|
+
const {getByTestId} = renderWithVuetify(VcChecklistItem, {
|
|
77
|
+
props: {
|
|
78
|
+
disabled: true,
|
|
79
|
+
tooltipContent: 'Peter is sleeping',
|
|
80
|
+
label: "Peter Parker",
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const listObj = getByTestId('VcChecklistItem');
|
|
85
|
+
|
|
86
|
+
await userEvent.hover(listObj)
|
|
87
|
+
// Let the hover commence
|
|
88
|
+
await waitFor( () => {
|
|
89
|
+
const tooltipContent = getByTestId('vc-tooltip-dark-content');
|
|
90
|
+
expect(tooltipContent).toBeVisible()
|
|
91
|
+
}, {timeout: 200})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import VcChecklistItemCmp from './VcChecklistItem';
|
|
2
|
+
import {action} from "@storybook/addon-actions";
|
|
3
|
+
|
|
4
|
+
const Template = (args, {argTypes}) => ({
|
|
5
|
+
components: {VcChecklistItem: VcChecklistItemCmp},
|
|
6
|
+
props: Object.keys(argTypes),
|
|
7
|
+
template: `
|
|
8
|
+
<div>
|
|
9
|
+
<br/>
|
|
10
|
+
<br/>
|
|
11
|
+
<br/>
|
|
12
|
+
<br/>
|
|
13
|
+
<br/>
|
|
14
|
+
<br/>
|
|
15
|
+
<div style="border: 1px solid; width: 310px">
|
|
16
|
+
<VcChecklistItem :avatar="avatar"
|
|
17
|
+
v-model="checked"
|
|
18
|
+
:label="label"
|
|
19
|
+
:disabled="disabled"
|
|
20
|
+
:tooltip-content="tooltipContent"
|
|
21
|
+
:data-qa="dataQa"
|
|
22
|
+
@change="onChange"/>
|
|
23
|
+
</div>
|
|
24
|
+
</div>`,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const Playground = Template.bind({});
|
|
28
|
+
|
|
29
|
+
// Set default values
|
|
30
|
+
Playground.args = {
|
|
31
|
+
checked: false,
|
|
32
|
+
disabled: false,
|
|
33
|
+
label: "Peter Parker",
|
|
34
|
+
tooltipContent: "Peter is seek with Covid-19",
|
|
35
|
+
avatar: {
|
|
36
|
+
path: "https://www.citypng.com/public/uploads/preview/-101609838369it1a5cyvuz.png",
|
|
37
|
+
colorId: 10
|
|
38
|
+
},
|
|
39
|
+
dataQa: 'vc-checklist-item',
|
|
40
|
+
onChange: action('changed'),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
title: 'form / list box / VcChecklistItem', // This will control the story sidebar position
|
|
45
|
+
id: 'VcChecklistItem', // This will be the link to this component
|
|
46
|
+
component: VcChecklistItemCmp,
|
|
47
|
+
parameters: {
|
|
48
|
+
design: {
|
|
49
|
+
type: 'figma',
|
|
50
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=7340%3A69294',
|
|
51
|
+
},
|
|
52
|
+
status: {
|
|
53
|
+
type: 'releaseCandidate', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VcTooltip :content="tooltipContent"
|
|
3
|
+
dark
|
|
4
|
+
:disabled="!tooltipContent || !disabled"
|
|
5
|
+
class="VcChecklistItem-wrapper">
|
|
6
|
+
<template>
|
|
7
|
+
<VcLayout class="VcChecklistItem" :data-qa="dataQa"
|
|
8
|
+
:class="{'disabled': disabled}">
|
|
9
|
+
<VcCheckbox :checked="checked"
|
|
10
|
+
:avatar="getAvatar"
|
|
11
|
+
:label="label"
|
|
12
|
+
:show-avatar-border="false"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:data-qa="`${dataQa}-checkbox`"
|
|
15
|
+
@change="onChange">
|
|
16
|
+
|
|
17
|
+
</VcCheckbox>
|
|
18
|
+
</VcLayout>
|
|
19
|
+
</template>
|
|
20
|
+
</VcTooltip>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
|
|
25
|
+
import VcCheckbox from "@/components/VcCheckbox/VcCheckbox.vue";
|
|
26
|
+
import VcLayout from "@/components/VcLayout/VcLayout.vue";
|
|
27
|
+
import VcTooltip from "@/components/VcTooltip/VcTooltip.vue";
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: "VcChecklistItem",
|
|
31
|
+
components: {VcLayout, VcCheckbox, VcTooltip},
|
|
32
|
+
model: {
|
|
33
|
+
prop: 'checked',
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
checked: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
label: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
avatar: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: undefined,
|
|
47
|
+
},
|
|
48
|
+
disabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
tooltipContent: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ''
|
|
55
|
+
},
|
|
56
|
+
dataQa: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'VcChecklistItem'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
getAvatar() {
|
|
63
|
+
if (this.avatar && Object.keys(this.avatar).length) {
|
|
64
|
+
return {
|
|
65
|
+
name: this.label,
|
|
66
|
+
...this.avatar,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
onChange(val) {
|
|
73
|
+
this.$emit('change', {checked: val})
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="scss" scoped>
|
|
80
|
+
@import '@/../styles/variables.scss';
|
|
81
|
+
@import "@/../src/scss/mixins.scss";
|
|
82
|
+
|
|
83
|
+
.VcChecklistItem-wrapper {
|
|
84
|
+
width: 100%;
|
|
85
|
+
|
|
86
|
+
.VcChecklistItem {
|
|
87
|
+
padding: var(--size-value2) var(--size-value4);
|
|
88
|
+
|
|
89
|
+
&.disabled {
|
|
90
|
+
background-color: var(--gray-lighten-3);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.vc-checkbox {
|
|
94
|
+
flex: 1 1 auto;
|
|
95
|
+
padding: var(--size-value0);
|
|
96
|
+
margin: var(--size-value0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:hover {
|
|
100
|
+
background-color: var(--gray-lighten-3);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus {
|
|
104
|
+
box-shadow: 0 0 0 2px var(--v-secondary-lighten1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:active {
|
|
108
|
+
background-color: var(--v-secondary-lighten3);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|