@vcita/design-system 0.2.0 → 0.2.4
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 +19 -0
- package/config/locales/ds.en.yml +2 -0
- package/dist/@vcita/design-system.esm.js +1141 -588
- package/dist/@vcita/design-system.min.js +1 -1
- package/dist/@vcita/design-system.ssr.js +1046 -526
- package/init/DesignSystem.js +13 -3
- package/init/initI18n.js +5 -1
- package/init/svgImages.js +11 -0
- package/init/vuetify.config.js +6 -6
- package/package.json +1 -1
- package/src/components/VcEmptyState/VcEmptyState.vue +22 -4
- package/src/components/VcFilterPanel/VcFilterPanel.spec.js +1 -1
- package/src/components/VcProgressCircular/VcProgressCircular.spec.js +109 -0
- package/src/components/VcProgressCircular/VcProgressCircular.stories.js +58 -0
- package/src/components/VcProgressCircular/VcProgressCircular.vue +88 -0
- package/{init → src/components}/VcSvg/VcSvg.stories.js +5 -1
- package/{init → src/components}/VcSvg/VcSvg.vue +0 -0
- package/src/components/VcTextField/VcTextField.spec.js +13 -95
- package/src/components/VcTextField/VcTextField.stories.js +60 -41
- package/src/components/VcTextField/VcTextField.vue +78 -155
- package/src/components/VcTooltip/VcTooltip.spec.js +3 -3
- package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.spec.js +109 -0
- package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.stories.js +58 -0
- package/src/components/Wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue +85 -0
- package/src/components/Wizard/VcSteperContant/VcStepperContent.spec.js +163 -0
- package/src/components/Wizard/VcSteperContant/VcStepperContent.stories.js +118 -0
- package/src/components/Wizard/VcSteperContant/VcStepperContent.vue +153 -0
- package/src/components/Wizard/VcStepsBar/VcStepsBar.spec.js +122 -0
- package/src/components/Wizard/VcStepsBar/VcStepsBar.stories.js +56 -0
- package/src/components/Wizard/VcStepsBar/VcStepsBar.vue +190 -0
- package/src/components/index.js +5 -1
- package/src/components/list/VcListItem/VcListItem.vue +1 -3
- package/src/.DS_Store +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
2
|
+
import VcStepsBar from "./VcStepsBar";
|
|
3
|
+
import Vuetify from 'vuetify'
|
|
4
|
+
import {render, waitFor} from "@testing-library/vue";
|
|
5
|
+
import init from "../../../../testing-library.config"
|
|
6
|
+
|
|
7
|
+
init();
|
|
8
|
+
|
|
9
|
+
const props = {
|
|
10
|
+
steps: [
|
|
11
|
+
{name: 'Step name 1'},
|
|
12
|
+
{name: 'Step name 2'},
|
|
13
|
+
{name: 'Step name 3'},
|
|
14
|
+
{name: 'Step name 4'}
|
|
15
|
+
],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe("VcStepsBar.vue", () => {
|
|
19
|
+
|
|
20
|
+
const renderWithVuetify = (component, options, callback) => {
|
|
21
|
+
const root = document.createElement('div')
|
|
22
|
+
root.setAttribute('data-app', 'true')
|
|
23
|
+
|
|
24
|
+
return render(
|
|
25
|
+
component,
|
|
26
|
+
{
|
|
27
|
+
container: document.body.appendChild(root),
|
|
28
|
+
// for Vuetify components that use the vuetify instance property
|
|
29
|
+
vuetify: new Vuetify(),
|
|
30
|
+
...options,
|
|
31
|
+
mocks: {},
|
|
32
|
+
},
|
|
33
|
+
callback,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
it("Basic stepsBar", async () => {
|
|
38
|
+
// Queries: https://testing-library.com/docs/queries/about#types-of-queries
|
|
39
|
+
const {container, getByTestId, getByText} = renderWithVuetify(VcStepsBar, {
|
|
40
|
+
props: {
|
|
41
|
+
...props,
|
|
42
|
+
title: 'Title',
|
|
43
|
+
dataQa: 'vcStepsBar',
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Expect options: https://github.com/testing-library/jest-dom
|
|
48
|
+
expect(container).toHaveAttribute('data-app', 'true');
|
|
49
|
+
|
|
50
|
+
const stepsBar = getByTestId('vcStepsBar');
|
|
51
|
+
expect(stepsBar).toBeInTheDocument();
|
|
52
|
+
|
|
53
|
+
const title = getByText('Title');
|
|
54
|
+
expect(title).toBeInTheDocument();
|
|
55
|
+
|
|
56
|
+
const lastStep = getByText('Step name 4');
|
|
57
|
+
expect(lastStep).toBeVisible()
|
|
58
|
+
expect(lastStep.parentElement).toHaveClass('v-stepper__step', 'v-stepper__step--inactive')
|
|
59
|
+
|
|
60
|
+
await waitFor(() => {
|
|
61
|
+
const firstStep = document.getElementById('step-1')
|
|
62
|
+
expect(firstStep).toBeVisible()
|
|
63
|
+
expect(firstStep).toHaveClass('v-stepper__step--active')
|
|
64
|
+
}, {timeout: 200})
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("Step forward ", async () => {
|
|
68
|
+
const {updateProps} = renderWithVuetify(VcStepsBar, {props})
|
|
69
|
+
|
|
70
|
+
await updateProps({currentStep: 2})
|
|
71
|
+
const firstStep = document.getElementById('step-1')
|
|
72
|
+
expect(firstStep).toHaveClass('v-stepper__step--complete')
|
|
73
|
+
const secondStep = document.getElementById('step-2')
|
|
74
|
+
expect(secondStep).toHaveClass('v-stepper__step--active')
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("3 steps froward and a step back (getting to 3rd step) ", async () => {
|
|
78
|
+
const {updateProps} = renderWithVuetify(VcStepsBar, {props})
|
|
79
|
+
|
|
80
|
+
let currentStep = 1
|
|
81
|
+
await updateProps({currentStep: ++currentStep})
|
|
82
|
+
await updateProps({currentStep: ++currentStep})
|
|
83
|
+
await updateProps({currentStep: ++currentStep})
|
|
84
|
+
await updateProps({currentStep: --currentStep})
|
|
85
|
+
const step1 = document.getElementById('step-1')
|
|
86
|
+
expect(step1).toHaveClass('v-stepper__step--complete')
|
|
87
|
+
const step2 = document.getElementById('step-2')
|
|
88
|
+
expect(step2).toHaveClass('v-stepper__step--complete')
|
|
89
|
+
const step4 = document.getElementById('step-4')
|
|
90
|
+
expect(step4).toHaveClass('v-stepper__step--inactive')
|
|
91
|
+
const step3 = document.getElementById('step-3')
|
|
92
|
+
expect(step3).toHaveClass('v-stepper__step--active', 'v-stepper__step--complete')
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("Passing the steps length won't fail ", async () => {
|
|
96
|
+
const {emitted, updateProps} = renderWithVuetify(VcStepsBar, {props})
|
|
97
|
+
|
|
98
|
+
await updateProps({currentStep: 5})
|
|
99
|
+
expect(emitted().input.length).toBe(1);
|
|
100
|
+
expect(emitted().input[0]).toEqual([4]);
|
|
101
|
+
await updateProps({currentStep: 1})
|
|
102
|
+
await updateProps({currentStep: 2})
|
|
103
|
+
const step4 = document.getElementById('step-4')
|
|
104
|
+
expect(step4).toHaveClass('v-stepper__step--complete')
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("Set the current step to low the the first won't fail", async () => {
|
|
108
|
+
const {emitted, updateProps} = renderWithVuetify(VcStepsBar, {props})
|
|
109
|
+
|
|
110
|
+
await updateProps({currentStep: -1})
|
|
111
|
+
expect(emitted().input.length).toBe(1);
|
|
112
|
+
expect(emitted().input[0]).toEqual([1]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("Skip to a targeted step (3rd) ", async () => {
|
|
116
|
+
const {updateProps} = renderWithVuetify(VcStepsBar, {props})
|
|
117
|
+
|
|
118
|
+
await updateProps({currentStep: 3})
|
|
119
|
+
const step3 = document.getElementById('step-3')
|
|
120
|
+
expect(step3).toHaveClass('v-stepper__step--active')
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import VcStepsBarCmp from './VcStepsBar';
|
|
2
|
+
import {VcButton} from "../../index";
|
|
3
|
+
import {action} from "@storybook/addon-actions";
|
|
4
|
+
|
|
5
|
+
const GeneralTemplate = (args, {argTypes}) => ({
|
|
6
|
+
components: {VcStepsBar: VcStepsBarCmp, VcButton},
|
|
7
|
+
props: Object.keys(argTypes),
|
|
8
|
+
data: () => ({
|
|
9
|
+
currentStep: 1
|
|
10
|
+
}),
|
|
11
|
+
template: `
|
|
12
|
+
<div>
|
|
13
|
+
<VcStepsBar
|
|
14
|
+
v-model.number="currentStep"
|
|
15
|
+
:title="title"
|
|
16
|
+
:steps="steps"
|
|
17
|
+
:data-qa="dataQa"
|
|
18
|
+
@input="onOutOfRange"
|
|
19
|
+
/>
|
|
20
|
+
<v-layout justify-end style="margin: 24px">
|
|
21
|
+
<VcButton color="white" @click="() => --currentStep" style="margin-inline-end: 12px">Back</VcButton>
|
|
22
|
+
<VcButton @click="() => ++currentStep">Next</VcButton>
|
|
23
|
+
</v-layout>
|
|
24
|
+
</div>`,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const Playground = GeneralTemplate.bind({});
|
|
28
|
+
|
|
29
|
+
// Set default values
|
|
30
|
+
Playground.args = {
|
|
31
|
+
title: 'Title',
|
|
32
|
+
steps: [
|
|
33
|
+
{name: 'Step name 1'},
|
|
34
|
+
{name: 'Step name 2'},
|
|
35
|
+
{name: 'Step name 3'},
|
|
36
|
+
{name: 'Step name 4'}
|
|
37
|
+
],
|
|
38
|
+
onOutOfRange: action('Out of range'),
|
|
39
|
+
dataQa: 'vc-steps-bar',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default {
|
|
43
|
+
title: 'Wizard / VcStepsBar',
|
|
44
|
+
id: 'VcStepsBar',
|
|
45
|
+
component: VcStepsBarCmp,
|
|
46
|
+
parameters: {
|
|
47
|
+
design: {
|
|
48
|
+
type: 'figma',
|
|
49
|
+
url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=6724%3A68128',
|
|
50
|
+
},
|
|
51
|
+
status: {
|
|
52
|
+
type: 'beta', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
|
|
53
|
+
url: 'https://vuetifyjs.com/en/api/v-stepper/'
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-stepper class="vc-stepper"
|
|
4
|
+
v-model="currentStep"
|
|
5
|
+
vertical
|
|
6
|
+
:data-qa="dataQa">
|
|
7
|
+
<div v-if="title" class="stepper-title">{{ title }}</div>
|
|
8
|
+
<template v-for="(step, index) in steps">
|
|
9
|
+
<v-stepper-step
|
|
10
|
+
:key="`step-${index + 1}`"
|
|
11
|
+
:id="`step-${index + 1}`"
|
|
12
|
+
:complete="lastCompleted > index + 1"
|
|
13
|
+
:step="index + 1"
|
|
14
|
+
>
|
|
15
|
+
{{ step.name }}
|
|
16
|
+
</v-stepper-step>
|
|
17
|
+
</template>
|
|
18
|
+
</v-stepper>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: "VcStepsBar",
|
|
25
|
+
model:{
|
|
26
|
+
prop: 'currentStep',
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
currentStep: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 1,
|
|
32
|
+
},
|
|
33
|
+
steps: {
|
|
34
|
+
type: Array,
|
|
35
|
+
validator: steps => steps.every(step => step.name),
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
title: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
dataQa: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'vc-steps-bar'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
lastCompleted: 0,
|
|
50
|
+
FIRST_STEP: 1
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
nextStep() {
|
|
55
|
+
if (this.lastCompleted < this.currentStep) {
|
|
56
|
+
this.lastCompleted = this.currentStep
|
|
57
|
+
}
|
|
58
|
+
if (this.currentStep > this.steps.length) {
|
|
59
|
+
this.shareStep(this.steps.length)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
shareStep(step) {
|
|
63
|
+
this.$emit('input', step)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
currentStep: {
|
|
68
|
+
handler(newVal, oldVal) {
|
|
69
|
+
if (newVal > oldVal) {
|
|
70
|
+
this.nextStep()
|
|
71
|
+
}
|
|
72
|
+
if (newVal < this.FIRST_STEP) {
|
|
73
|
+
this.shareStep(this.FIRST_STEP)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="scss" scoped>
|
|
82
|
+
@import '@/../styles/variables.scss';
|
|
83
|
+
|
|
84
|
+
.vc-stepper.v-stepper {
|
|
85
|
+
padding-block-start: var(--size-value4);
|
|
86
|
+
padding-inline-start: var(--size-value10);
|
|
87
|
+
|
|
88
|
+
.stepper-title {
|
|
89
|
+
margin-block-end: var(--size-value6);
|
|
90
|
+
font-weight: var(--font-weight-large2);
|
|
91
|
+
font-size: var(--font-size-medium);
|
|
92
|
+
letter-spacing: 0.03em;
|
|
93
|
+
color: var(--gray-darken-5);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.v-stepper__step {
|
|
97
|
+
padding: var(--size-value0);
|
|
98
|
+
width: fit-content;
|
|
99
|
+
align-items: flex-start;
|
|
100
|
+
margin-block-end: var(--size-value1);
|
|
101
|
+
|
|
102
|
+
::v-deep {
|
|
103
|
+
.v-stepper__label {
|
|
104
|
+
padding-inline-end: var(--size-value6);
|
|
105
|
+
text-shadow: none;
|
|
106
|
+
font-size: var(--font-size-small2);
|
|
107
|
+
letter-spacing: 0.01em;
|
|
108
|
+
line-height: var(--size-value6);
|
|
109
|
+
padding-bottom: var(--size-value7);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
span.v-stepper__step__step {
|
|
113
|
+
height: var(--size-value5);
|
|
114
|
+
min-width: var(--size-value5);
|
|
115
|
+
width: var(--size-value5);
|
|
116
|
+
margin-inline-end: var(--size-value3);
|
|
117
|
+
margin-inline-start: var(--size-value0);
|
|
118
|
+
margin-block: 2px;
|
|
119
|
+
font-size: var(--font-size-xx-small);
|
|
120
|
+
font-weight: var(--font-weight-medium2);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Default
|
|
125
|
+
&:not(.v-stepper__step--active):not(.v-stepper__step--complete) {
|
|
126
|
+
::v-deep {
|
|
127
|
+
span.v-stepper__step__step {
|
|
128
|
+
background-color: var(--gray-lighten-2);
|
|
129
|
+
color: var(--gray-darken-2);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.v-stepper__label {
|
|
133
|
+
color: var(--gray-darken-4);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Active
|
|
139
|
+
&.v-stepper__step--active:not(.v-stepper__step--complete) {
|
|
140
|
+
::v-deep {
|
|
141
|
+
span.v-stepper__step__step {
|
|
142
|
+
background-color: var(--v-secondary-base) !important;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.v-stepper__label {
|
|
146
|
+
color: var(--gray-darken-5);
|
|
147
|
+
font-weight: var(--font-weight-large);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Completed
|
|
153
|
+
&.v-stepper__step--complete {
|
|
154
|
+
::v-deep {
|
|
155
|
+
span.v-stepper__step__step {
|
|
156
|
+
background-color: var(--green) !important;
|
|
157
|
+
|
|
158
|
+
i {
|
|
159
|
+
font-size: var(--size-value3);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.v-stepper__label {
|
|
164
|
+
color: var(--gray-darken-5);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.v-stepper__step--active {
|
|
169
|
+
::v-deep {
|
|
170
|
+
.v-stepper__label {
|
|
171
|
+
font-weight: var(--font-weight-large);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:not(:last-child) {
|
|
178
|
+
&::after {
|
|
179
|
+
content: "";
|
|
180
|
+
border-inline-start: 2px solid var(--gray-lighten-1);
|
|
181
|
+
position: absolute;
|
|
182
|
+
top: 0;
|
|
183
|
+
margin-inline-start: 9px;
|
|
184
|
+
height: -webkit-fill-available;
|
|
185
|
+
margin-top: var(--size-value7);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -10,6 +10,9 @@ 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 './Wizard/VcStepsBar/VcStepsBar.vue';
|
|
14
|
+
export {default as VcMobileWizardProgress} from './Wizard/VcMobileWizardProgress/VcMobileWizardProgress.vue';
|
|
15
|
+
export {default as VcProgressCircular} from './VcProgressCircular/VcProgressCircular.vue';
|
|
13
16
|
// export {default as VcAutoComplete} from './VcAutoComplete/VcAutoComplete.vue';
|
|
14
17
|
export {default as VcButton} from './VcButton/VcButton.vue';
|
|
15
18
|
export {default as VcButtonGroup} from './VcButtonGroup/VcButtonGroup.vue';
|
|
@@ -21,7 +24,6 @@ export {default as VcSwitch} from './VcSwitch/VcSwitch.vue';
|
|
|
21
24
|
export {default as VcTextField} from './VcTextField/VcTextField.vue';
|
|
22
25
|
export {default as VcAvatar} from './VcAvatar/VcAvatar.vue';
|
|
23
26
|
export {default as VcTextArea} from './VcTextArea/VcTextArea.vue';
|
|
24
|
-
export {default as VcSvg} from '../../init/VcSvg/VcSvg.vue';
|
|
25
27
|
export {default as VcToast} from './VcToast/VcToast.vue';
|
|
26
28
|
export {default as VcCard} from './VcCard/VcCard.vue';
|
|
27
29
|
export {default as VcCheckbox} from './VcCheckbox/VcCheckbox.vue';
|
|
@@ -30,3 +32,5 @@ export {default as VcFocusArea} from './VcFocusArea/VcFocusArea.vue';
|
|
|
30
32
|
export {default as VcLink} from './VcLink/VcLink.vue';
|
|
31
33
|
export {default as VcListItem} from './list/VcListItem/VcListItem.vue';
|
|
32
34
|
export {default as VcGroupHeader} from './list/VcGroupHeader/VcGroupHeader.vue';
|
|
35
|
+
export {default as VcEmptyState} from './VcEmptyState/VcEmptyState.vue';
|
|
36
|
+
export {default as VcSvg} from './VcSvg/VcSvg.vue';
|
package/src/.DS_Store
DELETED
|
Binary file
|