@vcita/design-system 0.2.5 → 0.2.6
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/config/locales/ds.en.yml +3 -0
- package/dist/@vcita/design-system.esm.js +664 -553
- package/dist/@vcita/design-system.min.js +1 -1
- package/dist/@vcita/design-system.ssr.js +567 -464
- package/package.json +1 -1
- package/src/components/index.js +3 -2
- package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.spec.js +0 -0
- package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.stories.js +0 -0
- package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.vue +4 -0
- package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.spec.js +0 -0
- package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.stories.js +0 -0
- package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.vue +64 -50
- package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.spec.js +0 -0
- package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.stories.js +0 -0
- package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.vue +6 -4
- package/src/components/wizard/VcWizard/VcWizard.spec.js +155 -0
- package/src/components/wizard/VcWizard/VcWizard.stories.js +115 -0
- package/src/components/wizard/VcWizard/VcWizard.vue +144 -0
- package/src/components/wizard/VcWizard/demoWizardPage.vue +29 -0
- package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.spec.js +100 -0
- package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.stories.js +67 -0
- package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.vue +95 -0
- package/src/scss/mixins.scss +6 -0
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -10,8 +10,8 @@ export {default as VcIconWithTooltip} from './VcIconWithTooltip/VcIconWithToolti
|
|
|
10
10
|
export {default as VcBottomActions} from './VcBottomActions/VcBottomActions.vue';
|
|
11
11
|
export {default as VcActionList} from './VcActionList/VcActionList.vue';
|
|
12
12
|
export {default as VcActions} from './VcActions/VcActions.vue';
|
|
13
|
-
export {default as VcStepsBar} from './
|
|
14
|
-
export {default as VcMobileWizardProgress} from './
|
|
13
|
+
export {default as VcStepsBar} from './wizard/VcStepsBar/VcStepsBar.vue';
|
|
14
|
+
export {default as VcMobileWizardProgress} from './wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue';
|
|
15
15
|
export {default as VcProgressCircular} from './VcProgressCircular/VcProgressCircular.vue';
|
|
16
16
|
// export {default as VcAutoComplete} from './VcAutoComplete/VcAutoComplete.vue';
|
|
17
17
|
export {default as VcButton} from './VcButton/VcButton.vue';
|
|
@@ -35,3 +35,4 @@ export {default as VcGroupHeader} from './list/VcGroupHeader/VcGroupHeader.vue';
|
|
|
35
35
|
export {default as VcEmptyState} from './VcEmptyState/VcEmptyState.vue';
|
|
36
36
|
export {default as VcSvg} from './VcSvg/VcSvg.vue';
|
|
37
37
|
export {default as VcBanner} from './VcBanner/VcBanner.vue'
|
|
38
|
+
export {default as VcWizardCtaContainer} from './wizard/VcWizardCtaContainer/VcWizardCtaContainer.vue';
|
package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.spec.js
RENAMED
|
File without changes
|
package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.stories.js
RENAMED
|
File without changes
|
|
@@ -68,6 +68,10 @@ export default {
|
|
|
68
68
|
@import '@/../styles/variables.scss';
|
|
69
69
|
|
|
70
70
|
.vc-mobile-wizard-progress {
|
|
71
|
+
padding: var(--size-value4);
|
|
72
|
+
background-color: var(--neutral-lighten-3);
|
|
73
|
+
width: 100%;
|
|
74
|
+
max-height: 84px;
|
|
71
75
|
.titles-container {
|
|
72
76
|
margin: var(--size-value0) var(--size-value4);
|
|
73
77
|
|
package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.spec.js
RENAMED
|
File without changes
|
package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.stories.js
RENAMED
|
File without changes
|
package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.vue
RENAMED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-model="currentStep"
|
|
4
|
-
:data-qa="dataQa">
|
|
2
|
+
<vc-layout column justify-start class="stepper-content-wrapper">
|
|
5
3
|
<VcLayout v-if="!isLoading" column class="stepper-header">
|
|
6
4
|
<div class="content-stepper-title">{{ getStepName }}</div>
|
|
7
5
|
<div class="content-stepper-description" v-html="getStepDescription"></div>
|
|
8
6
|
</VcLayout>
|
|
9
|
-
<v-stepper-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
<v-stepper class="vc-stepper-content"
|
|
8
|
+
v-model="currentStep"
|
|
9
|
+
:data-qa="dataQa">
|
|
10
|
+
<v-stepper-items>
|
|
11
|
+
<v-stepper-content v-for="(step, index) in steps" :key="`step-${index}`" :step="index + 1">
|
|
12
|
+
<VcLayout v-if="currentStep === index + 1" class="layout-content" column :justify-center="isLoading">
|
|
13
|
+
<VcLoader :size="LOADER_SIZE" :color="LOADER_COLOR" v-show="isLoading"/>
|
|
14
|
+
<slot :name="`alert-${index + 1}`"></slot>
|
|
15
|
+
<component
|
|
16
|
+
v-show="!isLoading"
|
|
17
|
+
:is="step.component"
|
|
18
|
+
v-bind="{...wizardData, ...step.props}"
|
|
19
|
+
v-on="step.event"
|
|
20
|
+
@submit="data => $emit('submit', data)"
|
|
21
|
+
:data-qa="getStepQa(index)"
|
|
22
|
+
/>
|
|
23
|
+
</VcLayout>
|
|
24
|
+
</v-stepper-content>
|
|
25
|
+
</v-stepper-items>
|
|
26
|
+
</v-stepper>
|
|
27
|
+
</vc-layout>
|
|
28
|
+
|
|
26
29
|
</template>
|
|
27
30
|
|
|
28
31
|
<script>
|
|
@@ -35,6 +38,10 @@ export default {
|
|
|
35
38
|
prop: 'currentStep',
|
|
36
39
|
},
|
|
37
40
|
props: {
|
|
41
|
+
wizardData: {
|
|
42
|
+
type: Object,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
38
45
|
currentStep: {
|
|
39
46
|
type: Number,
|
|
40
47
|
default: 1,
|
|
@@ -44,14 +51,6 @@ export default {
|
|
|
44
51
|
validator: steps => steps.every(step => step.component && step.name),
|
|
45
52
|
required: true
|
|
46
53
|
},
|
|
47
|
-
title: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: ''
|
|
50
|
-
},
|
|
51
|
-
description: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: ''
|
|
54
|
-
},
|
|
55
54
|
dataQa: {
|
|
56
55
|
type: String,
|
|
57
56
|
default: 'vc-content-wizard'
|
|
@@ -116,34 +115,49 @@ export default {
|
|
|
116
115
|
<style lang="scss" scoped>
|
|
117
116
|
@import '@/../styles/variables.scss';
|
|
118
117
|
@import "@/../src/scss/mixins.scss";
|
|
118
|
+
.stepper-content-wrapper {
|
|
119
|
+
max-height: 100%;
|
|
120
|
+
width: 100%;
|
|
121
|
+
padding-bottom: var(--size-value6);
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
123
|
+
}
|
|
124
|
+
.layout-content {
|
|
125
|
+
@include md-and-up {
|
|
126
|
+
padding-block-start: var(--size-value3);
|
|
127
|
+
padding-inline: var(--size-value10);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
.stepper-header {
|
|
131
|
+
margin-block-end: var(--size-value7);
|
|
132
|
+
@include md-and-up {
|
|
133
|
+
padding-block-start: var(--size-value3);
|
|
134
|
+
padding-inline: var(--size-value10);
|
|
135
|
+
}
|
|
136
|
+
.content-stepper- {
|
|
137
|
+
&title {
|
|
138
|
+
letter-spacing: 0.01em;
|
|
139
|
+
font-size: var(--font-size-medium);
|
|
140
|
+
font-weight: var(--font-weight-large);
|
|
141
|
+
line-height: var(--size-value8);
|
|
142
|
+
color: var(--gray-darken-5);
|
|
133
143
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
144
|
+
@include md-and-up {
|
|
145
|
+
font-size: var(--font-size-medium2);
|
|
137
146
|
}
|
|
147
|
+
}
|
|
138
148
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
149
|
+
&description {
|
|
150
|
+
font-size: var(--font-size-x-small);
|
|
151
|
+
line-height: var(--size-value5);
|
|
152
|
+
color: var(--gray-darken-4);
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
|
-
|
|
155
|
+
}
|
|
156
|
+
.vc-stepper-content.v-stepper {
|
|
157
|
+
width: 100%;
|
|
158
|
+
box-shadow: none;
|
|
159
|
+
max-height: 100%;
|
|
160
|
+
overflow: auto;
|
|
147
161
|
::v-deep {
|
|
148
162
|
.v-stepper__items .v-stepper__content {
|
|
149
163
|
padding: 0;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="vc-stepper-container" data-qa="vc-steps-bar">
|
|
3
3
|
<v-stepper class="vc-stepper"
|
|
4
4
|
v-model="currentStep"
|
|
5
5
|
vertical
|
|
@@ -80,11 +80,13 @@ export default {
|
|
|
80
80
|
|
|
81
81
|
<style lang="scss" scoped>
|
|
82
82
|
@import '@/../styles/variables.scss';
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
.vc-stepper-container {
|
|
84
|
+
height: 100%;
|
|
85
85
|
padding-block-start: var(--size-value4);
|
|
86
86
|
padding-inline-start: var(--size-value10);
|
|
87
|
-
|
|
87
|
+
}
|
|
88
|
+
.vc-stepper.v-stepper {
|
|
89
|
+
box-shadow: none;
|
|
88
90
|
.stepper-title {
|
|
89
91
|
margin-block-end: var(--size-value6);
|
|
90
92
|
font-weight: var(--font-weight-large2);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcWizard from "./VcWizard";
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import {getByText, render} from "@testing-library/vue";
|
|
5
|
+
import {within} from '@testing-library/dom'
|
|
6
|
+
|
|
7
|
+
import init from "../../../../testing-library.config"
|
|
8
|
+
import userEvent from "@testing-library/user-event";
|
|
9
|
+
|
|
10
|
+
init();
|
|
11
|
+
|
|
12
|
+
const defaultSteps = [
|
|
13
|
+
{
|
|
14
|
+
name: 'Step name 1',
|
|
15
|
+
description: 'A description for step 1',
|
|
16
|
+
component: () => import('@/components/VcTextArea/VcTextArea.vue'),
|
|
17
|
+
props: {
|
|
18
|
+
placeholder: '"It\'s Not Who I Am Underneath, But What I Do, That Defines Me."\n'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'Step name 2',
|
|
23
|
+
component: () => import('./demoWizardPage'),
|
|
24
|
+
props: {
|
|
25
|
+
|
|
26
|
+
},
|
|
27
|
+
nextStepEnabledRules: [val => val.textFieldValue === '123'],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
isNextButtonDisabled: false,
|
|
31
|
+
name: 'Step name 3',
|
|
32
|
+
description: 'A description for step 3',
|
|
33
|
+
component: () => import('@/components/VcAlert/VcAlert.vue'),
|
|
34
|
+
props: {
|
|
35
|
+
type: 'info',
|
|
36
|
+
headerText: 'Header:',
|
|
37
|
+
bodyText: `I learned long ago, never to wrestle with a pig.
|
|
38
|
+
You get dirty, and besides, the pig likes it. <a href="https://images.squarespace-cdn.com/content/v1/5b71e83f1aef1d3e4bbd03f2/1534201222036-JHLKSIPN8AOXD4XNLRAN/Esther_main_image_1.jpg?format=2500w"
|
|
39
|
+
target="_blank">Link</a>`,
|
|
40
|
+
closeButton: true,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
isBackDisplayed: false,
|
|
45
|
+
name: 'Step name 4',
|
|
46
|
+
component: () => import('@/components/VcEmptyState/VcEmptyState.vue'),
|
|
47
|
+
props: {
|
|
48
|
+
icon: require('@/stories/assets/rabbit.svg'),
|
|
49
|
+
title: 'Title',
|
|
50
|
+
subtitle: 'Subtitle',
|
|
51
|
+
content: 'content text',
|
|
52
|
+
button: 'Reload',
|
|
53
|
+
linkLabel: 'link label',
|
|
54
|
+
linkUrl: 'www.google.com'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
|
+
describe("VcWizard.vue", () => {
|
|
59
|
+
|
|
60
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
61
|
+
const root = document.createElement('div')
|
|
62
|
+
root.setAttribute('data-app', 'true')
|
|
63
|
+
|
|
64
|
+
return render(
|
|
65
|
+
component,
|
|
66
|
+
{
|
|
67
|
+
container: document.body.appendChild(root),
|
|
68
|
+
// for Vuetify components that use the vuetify instance property
|
|
69
|
+
vuetify: new Vuetify(),
|
|
70
|
+
...options,
|
|
71
|
+
mocks: {
|
|
72
|
+
$dst: value => value,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
callback,
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
it("Basic VcWizard", () => {
|
|
80
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
81
|
+
const {container} = renderWithVuetify(VcWizard, {
|
|
82
|
+
props: {
|
|
83
|
+
steps: defaultSteps,
|
|
84
|
+
dataQa: 'vcWizard',
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
89
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("moves forward a step, updates text button, and then back successfully ", async () => {
|
|
93
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
94
|
+
const {getByTestId, findByTestId, queryByText} = renderWithVuetify(VcWizard, {
|
|
95
|
+
props: {
|
|
96
|
+
steps: defaultSteps,
|
|
97
|
+
dataQa: 'vcWizard',
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
const nextButton = getByTestId("vcWizard-wizard-next-button")
|
|
101
|
+
await userEvent.click(nextButton);
|
|
102
|
+
const stepperElement = getByTestId("vc-steps-bar")
|
|
103
|
+
|
|
104
|
+
let activeStep = await within(stepperElement).findByText("Step name 2")
|
|
105
|
+
expect(activeStep.parentElement).toHaveClass("v-stepper__step--active")
|
|
106
|
+
|
|
107
|
+
const demoButton = await findByTestId('test-button')
|
|
108
|
+
await userEvent.click(demoButton);
|
|
109
|
+
let backButton = queryByText("new text")
|
|
110
|
+
|
|
111
|
+
expect(backButton).toBeTruthy()
|
|
112
|
+
|
|
113
|
+
await userEvent.click(backButton);
|
|
114
|
+
activeStep = await within(stepperElement).findByText("Step name 1")
|
|
115
|
+
expect(activeStep.parentElement).toHaveClass("v-stepper__step--active")
|
|
116
|
+
});
|
|
117
|
+
it("moves forward but not longer than number of possible steps ", async () => {
|
|
118
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
119
|
+
const {emitted, getByTestId, queryByTestId, findByTestId} = renderWithVuetify(VcWizard, {
|
|
120
|
+
props: {
|
|
121
|
+
steps: defaultSteps,
|
|
122
|
+
dataQa: 'vcWizard',
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
const stepperElement = getByTestId("vc-steps-bar")
|
|
126
|
+
|
|
127
|
+
let nextButton = getByTestId("vcWizard-wizard-next-button")
|
|
128
|
+
await userEvent.click(nextButton);
|
|
129
|
+
|
|
130
|
+
let activeStep = await within(stepperElement).findByText("Step name 2")
|
|
131
|
+
expect(activeStep.parentElement).toHaveClass("v-stepper__step--active")
|
|
132
|
+
expect(nextButton).toHaveClass('v-btn--disabled')
|
|
133
|
+
|
|
134
|
+
const textInput = await findByTestId('text-input')
|
|
135
|
+
await userEvent.type(textInput, "1");
|
|
136
|
+
await userEvent.type(textInput, "2");
|
|
137
|
+
await userEvent.type(textInput, "3");
|
|
138
|
+
nextButton = await findByTestId("vcWizard-wizard-next-button")
|
|
139
|
+
|
|
140
|
+
expect(nextButton).not.toHaveClass("v-btn--disabled")
|
|
141
|
+
|
|
142
|
+
await userEvent.click(nextButton);
|
|
143
|
+
await userEvent.click(nextButton);
|
|
144
|
+
await userEvent.click(nextButton);
|
|
145
|
+
|
|
146
|
+
activeStep = await within(stepperElement).findByText("Step name 4")
|
|
147
|
+
expect(activeStep.parentElement).toHaveClass("v-stepper__step--active")
|
|
148
|
+
|
|
149
|
+
expect(emitted().submit.length).toBe(1);
|
|
150
|
+
const backButton = queryByTestId("vcWizard-wizard-back-button")
|
|
151
|
+
expect(backButton).toBe(null)
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import VcWizardCmp from './VcWizard';
|
|
2
|
+
import {action} from "@storybook/addon-actions";
|
|
3
|
+
|
|
4
|
+
const GeneralTemplate = (args, {argTypes}) => ({
|
|
5
|
+
components: {VcWizard: VcWizardCmp},
|
|
6
|
+
props: Object.keys(argTypes),
|
|
7
|
+
data: () => ({
|
|
8
|
+
currentStep: 1
|
|
9
|
+
}),
|
|
10
|
+
template: `
|
|
11
|
+
<div>
|
|
12
|
+
<VcWizard
|
|
13
|
+
v-model.number="currentStep"
|
|
14
|
+
:steps="steps"
|
|
15
|
+
@submit="onSubmit"
|
|
16
|
+
:data-qa="dataQa"
|
|
17
|
+
/>
|
|
18
|
+
</div>`,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const Playground = GeneralTemplate.bind({});
|
|
22
|
+
|
|
23
|
+
// Set default values
|
|
24
|
+
Playground.args = {
|
|
25
|
+
onSubmit: action('submit'),
|
|
26
|
+
steps: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Step name 1',
|
|
29
|
+
description: 'A description for step 1',
|
|
30
|
+
component: () => import('@/components/VcTextArea/VcTextArea.vue'),
|
|
31
|
+
props: {
|
|
32
|
+
placeholder: '"It\'s Not Who I Am Underneath, But What I Do, That Defines Me."\n'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
isNextButtonDisabled: true,
|
|
37
|
+
name: 'Step name 2',
|
|
38
|
+
component: () => import('./demoWizardPage'),
|
|
39
|
+
nextStepEnabledRules: [val => val.textFieldValue === '123'],
|
|
40
|
+
props: {
|
|
41
|
+
numOfButtons: 4,
|
|
42
|
+
buttons: [{
|
|
43
|
+
id: 'today',
|
|
44
|
+
label: 'Today',
|
|
45
|
+
disabled: false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'yesterday',
|
|
49
|
+
label: 'Yesterday',
|
|
50
|
+
disabled: false
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: '7days',
|
|
54
|
+
label: '7 days',
|
|
55
|
+
disabled: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: '3months',
|
|
59
|
+
label: '3 months',
|
|
60
|
+
disabled: false
|
|
61
|
+
}],
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Step name 3',
|
|
66
|
+
description: 'A description for step 3',
|
|
67
|
+
component: () => import('@/components/VcAlert/VcAlert.vue'),
|
|
68
|
+
props: {
|
|
69
|
+
type: 'info',
|
|
70
|
+
headerText: 'Header:',
|
|
71
|
+
bodyText: `I learned long ago, never to wrestle with a pig.
|
|
72
|
+
You get dirty, and besides, the pig likes it. <a href="https://images.squarespace-cdn.com/content/v1/5b71e83f1aef1d3e4bbd03f2/1534201222036-JHLKSIPN8AOXD4XNLRAN/Esther_main_image_1.jpg?format=2500w"
|
|
73
|
+
target="_blank">Link</a>`,
|
|
74
|
+
closeButton: true,
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Step name 4',
|
|
79
|
+
component: () => import('@/components/VcEmptyState/VcEmptyState.vue'),
|
|
80
|
+
props: {
|
|
81
|
+
icon: require('@/stories/assets/rabbit.svg'),
|
|
82
|
+
title: 'Title',
|
|
83
|
+
subtitle: 'Subtitle',
|
|
84
|
+
content: 'content text',
|
|
85
|
+
button: 'Reload',
|
|
86
|
+
linkLabel: 'link label',
|
|
87
|
+
linkUrl: 'www.google.com'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
dataQa: 'vc-wizard',
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export default {
|
|
95
|
+
title: 'Wizard / VcWizard',
|
|
96
|
+
id: 'Vcwizard',
|
|
97
|
+
component: VcWizardCmp,
|
|
98
|
+
argTypes: {
|
|
99
|
+
value: {
|
|
100
|
+
table: {
|
|
101
|
+
disable: true,
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
parameters: {
|
|
106
|
+
design: {
|
|
107
|
+
type: 'figma',
|
|
108
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=6718%3A79786',
|
|
109
|
+
},
|
|
110
|
+
status: {
|
|
111
|
+
type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
112
|
+
url: 'https://vuetifyjs.com/en/components/progress-circular'
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout class="vc-wizard" column align-start justify-start>
|
|
3
|
+
<VcMobileWizardProgress
|
|
4
|
+
v-if="!$vuetify.breakpoint.mdAndUp"
|
|
5
|
+
:dataQa="dataQa"
|
|
6
|
+
:currentStep="currentStep"
|
|
7
|
+
:steps="wizardSteps"/>
|
|
8
|
+
<VcStepsBar
|
|
9
|
+
v-else
|
|
10
|
+
:currentStep="currentStep"
|
|
11
|
+
:steps="wizardSteps"
|
|
12
|
+
:title="title"
|
|
13
|
+
:dataQa="dataQa"
|
|
14
|
+
/>
|
|
15
|
+
<VcStepperContent
|
|
16
|
+
:wizardData="wizardData"
|
|
17
|
+
@submit="handleSubmit"
|
|
18
|
+
:currentStep="currentStep"
|
|
19
|
+
:steps="wizardSteps"
|
|
20
|
+
:dataQa="dataQa"
|
|
21
|
+
/>
|
|
22
|
+
<VcWizardCtaContainer
|
|
23
|
+
:isBackDisplayed="isBackDisplayed"
|
|
24
|
+
:isNextButtonDisabled="isNextButtonDisabled"
|
|
25
|
+
:backButtonLabel="currentStepObj.backButtonLabel || $dst('ds.wizard.back')"
|
|
26
|
+
:nextButtonLabel="currentStepObj.nextButtonLabel || $dst('ds.wizard.next')"
|
|
27
|
+
@onBackPressed="goBackOneStep"
|
|
28
|
+
@onNextPressed="goForwardOneStep"
|
|
29
|
+
:dataQa="dataQa"
|
|
30
|
+
/>
|
|
31
|
+
</v-layout>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import VcStepsBar from "@/components/wizard/VcStepsBar/VcStepsBar.vue"
|
|
36
|
+
import VcStepperContent from "@/components/wizard/VcSteperContent/VcStepperContent.vue"
|
|
37
|
+
import VcMobileWizardProgress from "@/components/wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue"
|
|
38
|
+
import VcWizardCtaContainer from "@/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.vue"
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: "VcWizard",
|
|
42
|
+
components: {VcStepsBar, VcStepperContent, VcMobileWizardProgress, VcWizardCtaContainer},
|
|
43
|
+
props: {
|
|
44
|
+
steps: {
|
|
45
|
+
type: [Array],
|
|
46
|
+
validator: steps => steps.every(step => step.name),
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
dataQa: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'wizard'
|
|
52
|
+
},
|
|
53
|
+
title: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ''
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
currentStep: 1,
|
|
61
|
+
wizardSteps: [],
|
|
62
|
+
wizardStepsData: {},
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
created() {
|
|
66
|
+
this.init();
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
init() {
|
|
70
|
+
this.currentStep = 1
|
|
71
|
+
this.wizardSteps = this.steps.slice()
|
|
72
|
+
},
|
|
73
|
+
goBackOneStep() {
|
|
74
|
+
this.wizardStepsData[this.currentStep] = undefined
|
|
75
|
+
this.$set(this.wizardStepsData, this.currentStep, undefined);
|
|
76
|
+
this.currentStep--;
|
|
77
|
+
},
|
|
78
|
+
handleSubmit(data) {
|
|
79
|
+
const stepData = data.stepData || {}
|
|
80
|
+
const wizardData = data.wizardData || {}
|
|
81
|
+
const newStepData = { ...this.currentStepObj, ...stepData};
|
|
82
|
+
const newWizardStepData = {...this.wizardStepsData[this.currentStep], ...wizardData}
|
|
83
|
+
this.$set(this.wizardStepsData, this.currentStep, newWizardStepData);
|
|
84
|
+
this.wizardSteps.splice(this.currentStep - 1, 1, newStepData)
|
|
85
|
+
},
|
|
86
|
+
goForwardOneStep() {
|
|
87
|
+
if(this.currentStep < this.wizardSteps.length) {
|
|
88
|
+
this.currentStep++;
|
|
89
|
+
} else {
|
|
90
|
+
this.$emit('submit', this.wizardSteps)
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
computed: {
|
|
95
|
+
wizardData() {
|
|
96
|
+
return Object.values(this.wizardStepsData).reduce((acc, currentValue) => ({ ...acc, ...currentValue}), {})
|
|
97
|
+
},
|
|
98
|
+
currentStepObj() {
|
|
99
|
+
return this.wizardSteps[this.currentStep - 1]
|
|
100
|
+
},
|
|
101
|
+
isBackDisplayed() {
|
|
102
|
+
return this.currentStepObj.isBackDisplayed !== undefined ? this.currentStepObj.isBackDisplayed : this.currentStep > 1
|
|
103
|
+
},
|
|
104
|
+
isNextButtonDisabled() {
|
|
105
|
+
if( this.currentStepObj.nextStepEnabledRules ) {
|
|
106
|
+
return this.currentStepObj.nextStepEnabledRules.every(rule => !rule(this.wizardData))
|
|
107
|
+
} else {
|
|
108
|
+
return this.currentStepObj.isNextButtonDisabled !== undefined ? this.currentStepObj.isNextButtonDisabled : false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style lang="scss" scoped>
|
|
116
|
+
@import '@/../styles/variables.scss';
|
|
117
|
+
@import "@/../src/scss/mixins.scss";
|
|
118
|
+
|
|
119
|
+
.vc-wizard {
|
|
120
|
+
height: 100%;
|
|
121
|
+
@include md-and-up {
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-template-columns: minmax(200px, 1fr) 3fr;
|
|
124
|
+
grid-template-rows: 400px 80px;
|
|
125
|
+
grid-column-gap: var(--size-value10);
|
|
126
|
+
grid-row-gap: 0px;
|
|
127
|
+
}
|
|
128
|
+
@include lg-and-up {
|
|
129
|
+
grid-column-gap: var(--size-value20);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.vc-stepper-container {
|
|
134
|
+
grid-area: 1 / 1 / 3 / 2;
|
|
135
|
+
border-inline-end: 1px solid #E0E0E0;
|
|
136
|
+
}
|
|
137
|
+
.wizard-cta-container {
|
|
138
|
+
grid-area: 2 / 2 / 3 / 3;
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
.stepper-content-wrapper {
|
|
142
|
+
grid-area: 1 / 2 / 2 / 3;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-layout class="demo-page">
|
|
3
|
+
<v-btn @click="$emit('submit', {stepData: {backButtonLabel: 'new text'}} )" data-qa="test-button" class="demo-page-button">
|
|
4
|
+
demo button text
|
|
5
|
+
</v-btn>
|
|
6
|
+
<VcTextArea data-qa="text-input" class="text-input" placeholder="enter 123 to proceed" @input="(data) => $emit('submit', {wizardData: {textFieldValue: data}} )" >
|
|
7
|
+
|
|
8
|
+
</VcTextArea>
|
|
9
|
+
<v-layout>
|
|
10
|
+
this will contain the text field value after it propagated up and down through the wizard {{textFieldValue}}
|
|
11
|
+
</v-layout>
|
|
12
|
+
</v-layout>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import VcTextArea from "@/components/VcTextArea/VcTextArea.vue";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
props: {
|
|
20
|
+
textFieldValue: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
components:{
|
|
26
|
+
VcTextArea
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|