@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.
Files changed (35) hide show
  1. package/CHANGELOG.MD +10 -0
  2. package/config/locales/ds.en.yml +2 -0
  3. package/dist/@vcita/design-system.esm.js +1082 -707
  4. package/dist/@vcita/design-system.min.js +1 -1
  5. package/dist/@vcita/design-system.ssr.js +953 -614
  6. package/init/SvgIcons.js +1 -0
  7. package/package.json +1 -1
  8. package/src/components/VcAvatar/VcAvatar.stories.js +13 -2
  9. package/src/components/VcAvatar/VcAvatar.vue +56 -20
  10. package/src/components/VcBanner/VcBanner.stories.js +11 -0
  11. package/src/components/VcBanner/VcBanner.vue +23 -18
  12. package/src/components/VcCheckbox/VcCheckbox.stories.js +2 -0
  13. package/src/components/VcCheckbox/VcCheckbox.vue +19 -14
  14. package/src/components/VcEmptyState/VcEmptyState.stories.js +18 -9
  15. package/src/components/VcEmptyState/VcEmptyState.vue +24 -15
  16. package/src/components/VcExpansionCard/VcExpansionCard.stories.js +35 -2
  17. package/src/components/VcExpansionCard/VcExpansionCard.vue +63 -53
  18. package/src/components/VcIconWithTooltip/VcIconWithTooltip.spec.js +1 -1
  19. package/src/components/VcImage/VcImage.spec.js +46 -0
  20. package/src/components/VcImage/VcImage.stories.js +34 -0
  21. package/src/components/VcImage/VcImage.vue +40 -0
  22. package/src/components/VcTooltip/VcTooltip.stories.js +3 -1
  23. package/src/components/VcTooltip/VcTooltip.vue +5 -0
  24. package/src/components/index.js +3 -0
  25. package/src/components/listBox/VcChecklistItem/VcChecklistItem.spec.js +93 -0
  26. package/src/components/listBox/VcChecklistItem/VcChecklistItem.stories.js +56 -0
  27. package/src/components/listBox/VcChecklistItem/VcChecklistItem.vue +112 -0
  28. package/src/components/listBox/VcListbox/VcListbox.spec.js +131 -0
  29. package/src/components/listBox/VcListbox/VcListbox.stories.js +79 -0
  30. package/src/components/listBox/VcListbox/VcListbox.vue +141 -0
  31. package/src/components/modal/VcNoticeModal/VcNoticeModal.stories.js +20 -19
  32. package/src/components/modal/VcNoticeModal/VcNoticeModal.vue +17 -6
  33. package/src/components/wizard/VcStepsBar/VcStepsBar.vue +26 -24
  34. package/src/components/wizard/VcWizard/VcWizard.spec.js +1 -1
  35. package/src/components/wizard/VcWizard/VcWizard.stories.js +1 -0
@@ -0,0 +1,131 @@
1
+ import '@testing-library/jest-dom'
2
+ import VcListbox from "./VcListbox.vue";
3
+ import Vuetify from 'vuetify'
4
+ import {render} from "@testing-library/vue";
5
+ import init from "../../../../testing-library.config";
6
+ import {fireEvent} from "@testing-library/dom";
7
+
8
+ init();
9
+
10
+ const props = {
11
+ dataQa: 'vc-list-box',
12
+ items: [
13
+ {
14
+ label: 'Peter Parker',
15
+ avatar: {
16
+ path: "https://www.citypng.com/public/uploads/preview/-101609838369it1a5cyvuz.png",
17
+ }
18
+ },
19
+ {
20
+ label: 'Tony Stark',
21
+ avatar: {
22
+ path: "https://www.drawingtutorials101.com/drawing-tutorials/Cartoon-Characters/Iron-Man/iron-man-helmet/how-to-draw-iron-mans-helmet.jpg",
23
+ }
24
+ },
25
+ {
26
+ label: 'Natasha Romanoff',
27
+ avatar: {
28
+ path: "https://i2.wp.com/starbaseatlanta.com/wp-content/uploads/mvatb73672.jpg?fit=464%2C650&ssl=1",
29
+ }
30
+ },
31
+ {
32
+ label: 'Bruce Banner',
33
+ avatar: {
34
+ path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStOD5bONT-oTnmD5Qdk7JY9OJWDW3Ts8ZCFCmHS4f4mETkg9AeY_8gTbCutSfKDq2GWkk&usqp=CAU",
35
+ },
36
+ disabled: true,
37
+ tooltipContent: 'Hulk is too STRONG'
38
+ },
39
+ {
40
+ label: 'Clint Barton',
41
+ avatar: {
42
+ colorId: 13,
43
+ },
44
+ },
45
+ ],
46
+ }
47
+
48
+ describe("VcListbox.vue", () => {
49
+
50
+ const renderWithVuetify = (component, options, callback) => {
51
+ const root = document.createElement('div')
52
+ root.setAttribute('data-app', 'true')
53
+
54
+ return render(
55
+ component,
56
+ {
57
+ container: document.body.appendChild(root),
58
+ // for Vuetify components that use the vuetify instance property
59
+ vuetify: new Vuetify(),
60
+ ...options,
61
+ mocks: {
62
+ $dst: value => value,
63
+ },
64
+ },
65
+ callback,
66
+ )
67
+ }
68
+
69
+ it("mounts with default settings", async () => {
70
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
71
+ const {container, getByText, getByTestId, emitted} = renderWithVuetify(VcListbox, {
72
+ props: {
73
+ ...props,
74
+ addAnother: true
75
+ }
76
+ })
77
+
78
+ // Expect options: https://github.com/testing-library/jest-dom
79
+ expect(container).toHaveAttribute('data-app', 'true');
80
+
81
+ const listbox = getByTestId(props.dataQa);
82
+ expect(listbox).toBeInTheDocument();
83
+
84
+ const checkbox = getByTestId(`${props.dataQa}-2-checkbox`);
85
+ expect(checkbox).not.toBeChecked()
86
+ const listObj = getByText(props.items[2].label)
87
+ expect(listObj).toBeInTheDocument();
88
+ await fireEvent.click(listObj);
89
+ expect(emitted().change.length).toBe(1);
90
+ expect(emitted().change[0]).toStrictEqual([{"checked": true, "id": 2}]);
91
+ expect(checkbox).toBeChecked()
92
+
93
+ const lastItem = container.getElementsByClassName('last-item')[0]
94
+ await fireEvent.click(lastItem);
95
+ expect(emitted().addNew.length).toBe(1);
96
+ expect(getByText('ds.listbox.add')).toBeInTheDocument();
97
+ });
98
+
99
+ it("Check title", () => {
100
+ const {getByTestId, getByText} = renderWithVuetify(VcListbox, {
101
+ props: {
102
+ ...props,
103
+ title: 'listbox title'
104
+ }
105
+ })
106
+
107
+ const listboxTitle = getByTestId(`${props.dataQa}-title`);
108
+ expect(listboxTitle).toBeInTheDocument();
109
+ expect(getByText('listbox title')).toBeInTheDocument();
110
+ })
111
+
112
+ it("With no title", async () => {
113
+ const {queryByTestId} = renderWithVuetify(VcListbox, {props})
114
+ const listboxTitle = queryByTestId(`${props.dataQa}-title`);
115
+ expect(listboxTitle).not.toBeInTheDocument();
116
+ });
117
+
118
+ it("With add another item button", async () => {
119
+ const {container, emitted, getByText} = renderWithVuetify(VcListbox, {
120
+ props: {
121
+ ...props,
122
+ addAnother: true,
123
+ addAnotherLabel: 'add new Item'
124
+ }
125
+ })
126
+ const lastItem = container.getElementsByClassName('last-item')[0]
127
+ await fireEvent.click(lastItem);
128
+ expect(emitted().addNew.length).toBe(1);
129
+ expect(getByText('add new Item')).toBeInTheDocument();
130
+ });
131
+ });
@@ -0,0 +1,79 @@
1
+ import VcListboxCmp from './VcListbox';
2
+ import {action} from "@storybook/addon-actions";
3
+
4
+ const Template = (args, {argTypes}) => ({
5
+ components: {VcListbox: VcListboxCmp},
6
+ props: Object.keys(argTypes),
7
+ template: `
8
+ <VcListbox :items="items"
9
+ :title="title"
10
+ :add-another="addAnother"
11
+ :add-another-label="addAnotherLabel"
12
+ :data-qa="dataQa"
13
+ @change="onChange"
14
+ @addNew="onAddNew">
15
+ </VcListbox>`,
16
+ })
17
+
18
+ export const Playground = Template.bind({});
19
+
20
+ // Set default values
21
+ Playground.args = {
22
+ title: 'Avengers crew',
23
+ addAnother: false,
24
+ addAnotherLabel: 'Add new Avenger',
25
+ dataQa: "vc-listbox",
26
+ items: [
27
+ {
28
+ label: 'Peter Parker',
29
+ avatar: {
30
+ path: "https://www.citypng.com/public/uploads/preview/-101609838369it1a5cyvuz.png",
31
+ }
32
+ },
33
+ {
34
+ label: 'Tony Stark',
35
+ avatar: {
36
+ path: "https://www.drawingtutorials101.com/drawing-tutorials/Cartoon-Characters/Iron-Man/iron-man-helmet/how-to-draw-iron-mans-helmet.jpg",
37
+ },
38
+ checked: true
39
+ },
40
+ {
41
+ label: 'Natasha Romanoff',
42
+ avatar: {
43
+ path: "https://i2.wp.com/starbaseatlanta.com/wp-content/uploads/mvatb73672.jpg?fit=464%2C650&ssl=1",
44
+ }
45
+ },
46
+ {
47
+ label: 'Bruce Banner',
48
+ avatar: {
49
+ path: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStOD5bONT-oTnmD5Qdk7JY9OJWDW3Ts8ZCFCmHS4f4mETkg9AeY_8gTbCutSfKDq2GWkk&usqp=CAU",
50
+ },
51
+ disabled: true,
52
+ tooltipContent: 'Hulk is too STRONG'
53
+ },
54
+ {
55
+ label: 'Clint Barton',
56
+ avatar: {
57
+ colorId: 13,
58
+ },
59
+ },
60
+ ],
61
+ onChange: action('changed'),
62
+ onAddNew: action('addNew'),
63
+ }
64
+
65
+ export default {
66
+ title: 'form / list box / VcListbox', // This will control the story sidebar position
67
+ id: 'VcListbox', // This will be the link to this component
68
+ component: VcListboxCmp,
69
+ parameters: {
70
+ design: {
71
+ type: 'figma',
72
+ url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=7340%3A69294',
73
+ },
74
+ status: {
75
+ type: 'releaseCandidate', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
76
+ url: 'https://vuetifyjs.com/en/components/lists/'
77
+ },
78
+ },
79
+ };
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="title"
4
+ class="vc-list-title"
5
+ :data-qa="`${dataQa}-title`">
6
+ {{ title }}
7
+ </div>
8
+
9
+ <v-list class="VcListbox"
10
+ :data-qa="dataQa">
11
+ <div class="vc-overflow">
12
+ <v-list-item class="vc-list-item"
13
+ v-for="(item, index) in items"
14
+ :tabindex="index"
15
+ :key="index">
16
+ <VcChecklistItem :data-qa="`${dataQa}-${index}`"
17
+ v-bind="item"
18
+ @change="args => $emit('change', {...args, id: index})">
19
+ </VcChecklistItem>
20
+ </v-list-item>
21
+ </div>
22
+
23
+ <div v-if="addAnother"
24
+ :data-qa="`${dataQa}-increase`">
25
+ <v-divider class="divider"></v-divider>
26
+ <v-list-item align-baseline class="last-item"
27
+ @click="$emit('addNew')">
28
+ <VcIcon class="add-another-icon" dense>$plus</VcIcon>
29
+ <span class="add-another-label">{{ getAddAnotherLabel }}</span>
30
+ </v-list-item>
31
+ </div>
32
+ </v-list>
33
+ </div>
34
+ </template>
35
+
36
+ <script>
37
+
38
+ import VcChecklistItem from "@/components/listBox/VcChecklistItem/VcChecklistItem.vue";
39
+ import VcIcon from "@/components/VcIcon/VcIcon.vue";
40
+
41
+ export default {
42
+ name: "VcListbox",
43
+ components: {VcChecklistItem, VcIcon},
44
+ props: {
45
+ items: {
46
+ type: Array,
47
+ required: true,
48
+ validator: items => items.every(item => item.label),
49
+ },
50
+ addAnother: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ addAnotherLabel: {
55
+ type: String,
56
+ default: ""
57
+ },
58
+ title: {
59
+ type: String,
60
+ default: ''
61
+ },
62
+ dataQa: {
63
+ type: String,
64
+ default: 'VcListbox'
65
+ }
66
+ },
67
+ computed: {
68
+ getAddAnotherLabel() {
69
+ return this.addAnotherLabel || this.$dst('ds.listbox.add')
70
+ }
71
+ }
72
+ };
73
+ </script>
74
+
75
+ <style lang="scss" scoped>
76
+ @import '@/../styles/variables.scss';
77
+ @import "@/../src/scss/mixins.scss";
78
+
79
+ .vc-list-title {
80
+ font-weight: var(--font-weight-medium2);
81
+ font-size: var(--font-size-small2);
82
+ line-height: var(--size-value5);
83
+ margin-block-end: var(--size-value3);
84
+ }
85
+
86
+ .VcListbox {
87
+ padding-block: var(--size-value1);
88
+ margin-block: var(--size-value1);
89
+ border: 1px solid var(--gray-lighten-1);
90
+ box-sizing: border-box;
91
+ border-radius: var(--border-radius);
92
+ width: fit-content;
93
+ box-shadow: none !important;
94
+
95
+ .vc-overflow {
96
+ overflow: auto;
97
+ max-height: 160px;
98
+
99
+ .vc-list-item {
100
+ padding: var(--size-value0);
101
+ min-height: unset;
102
+ }
103
+ }
104
+
105
+ .divider {
106
+ border-color: var(--gray-lighten-1);
107
+ }
108
+
109
+ .last-item {
110
+ cursor: pointer;
111
+ min-height: var(--size-value10);
112
+
113
+ &:hover {
114
+ background-color: var(--gray-lighten-3);
115
+ }
116
+
117
+ .add-another-label {
118
+ font-weight: var(--font-weight-medium2);
119
+ font-size: var(--font-size-x-small);
120
+ line-height: var(--size-value5);
121
+ color: var(--gray-darken-5);
122
+ }
123
+
124
+ .add-another-icon {
125
+ margin-inline-end: var(--size-value3);
126
+ cursor: pointer;
127
+
128
+ ::v-deep {
129
+ .v-icon__component {
130
+ height: unset;
131
+ width: unset;
132
+
133
+ svg {
134
+ width: var(--size-value3);
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ </style>
@@ -6,18 +6,13 @@ import VcModalFooter from "@/components/modal/elements/VcModalFooter";
6
6
  const Template = (args, {argTypes}) => ({
7
7
  components: {VcNoticeModal: VcNoticeModalCmp},
8
8
  props: Object.keys(argTypes),
9
- computed: {
10
- iconParam() {
11
- return require('@/stories/assets/rabbit.svg');
12
- },
13
- },
14
9
  template: `
15
10
  <div>
16
11
  <VcNoticeModal :show-dialog="showDialog"
17
12
  :useOffset="useOffset"
18
13
  :title-text="titleText"
19
14
  :subtitle-text="subtitleText"
20
- :icon="iconParam"
15
+ :image="image"
21
16
  :content-text="contentText"
22
17
  :size="size"
23
18
  :ok-button-label="okButtonLabel"
@@ -40,21 +35,17 @@ Playground.args = {
40
35
  size: 'lg',
41
36
  okButtonLabel: undefined,
42
37
  cancelButtonLabel: undefined,
38
+ image: require('@/stories/assets/rabbit.svg'),
43
39
  }
44
40
 
45
41
  const TemplateUsingSlot = (args, {argTypes}) => ({
46
42
  components: {VcNoticeModal: VcNoticeModalCmp, VcLayout, VcIcon},
47
43
  props: Object.keys(argTypes),
48
- computed: {
49
- iconParam() {
50
- return require('@/stories/assets/rabbit.svg');
51
- },
52
- },
53
44
  template: '<div><VcNoticeModal :show-dialog="showDialog" ' +
54
45
  ':useOffset="useOffset" ' +
55
46
  ':title-text="titleText" ' +
56
47
  ':subtitle-text="subtitleText" ' +
57
- ':icon="iconParam" ' +
48
+ ':image="image" ' +
58
49
  ':size="size" ' +
59
50
  '@onCloseButtonClicked="onCloseButtonClicked" ' +
60
51
  '@onOkClicked="onOkClicked" ' +
@@ -77,26 +68,22 @@ UsingContentSlot.args = {
77
68
  subtitleText: 'some more information about this issue, and some more information about this issue',
78
69
  contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
79
70
  size: 'lg',
71
+ image: require('@/stories/assets/rabbit.svg')
80
72
  }
81
73
 
82
74
  const TemplateUsingFooterSlot = (args, {argTypes}) => ({
83
75
  components: {VcNoticeModal: VcNoticeModalCmp, VcModalFooter},
84
76
  props: Object.keys(argTypes),
85
- computed: {
86
- iconParam() {
87
- return require('@/stories/assets/rabbit.svg');
88
- },
89
- },
90
77
  template: `
91
78
  <VcNoticeModal :show-dialog="showDialog" :useOffset="useOffset" :title-text="titleText" :subtitle-text="subtitleText"
92
- :content-text="contentText" :icon="iconParam" :size="size"
79
+ :content-text="contentText" :image="image" :size="size"
93
80
  @onCloseButtonClicked="onCloseButtonClicked" @onOkClicked="onOkClicked"
94
81
  @onCancelClicked="onCancelClicked">
95
82
  <template #footer>
96
83
  <VcModalFooter
97
84
  direction="vertical"
98
85
  :buttons='[
99
- {label:"Contact",event:"onContactClicked",color:"primary"},
86
+ {label:"Contact",event:"onContactClicked",color:"secondary"},
100
87
  {label:"Clear",event:"onClearClicked",color:"secondary"},
101
88
  {label:"Save",event:"onSaveClicked",color:"white"}
102
89
  ]'
@@ -118,6 +105,20 @@ UsingFooterSlot.args = {
118
105
  subtitleText: 'some more information about this issue, and some more information about this issue',
119
106
  contentText: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
120
107
  size: 'lg',
108
+ image: require('@/stories/assets/rabbit.svg'),
109
+ }
110
+
111
+ export const WithImageAsComponents = Template.bind({});
112
+
113
+ // Set default values
114
+ WithImageAsComponents.args = {
115
+ showDialog: true,
116
+ useOffset: false,
117
+ titleText: 'Notice with image slot',
118
+ subtitleText: 'It looks the same, what\'s the deal?',
119
+ contentText: 'In some projects you will have infrastructure that makes it impossible to pass an SVG in the usual way, because SVGs are treated as components. So the right way to pass them is using a slot.',
120
+ size: 'lg',
121
+ image: require('@/stories/assets/rabbit.svg'),
121
122
  }
122
123
 
123
124
  export default {
@@ -6,7 +6,7 @@
6
6
  @onCloseButtonClicked="$emit('onCloseButtonClicked')">
7
7
  <template #content>
8
8
  <VcLayout :class="`VcNoticeHeader ${flavor}`" column align-content-center>
9
- <img :src="icon" class="VcNoticeImage" :class="`${size}`">
9
+ <VcImage :image="currentImage" class="VcNoticeImage" :class="`${size}`"/>
10
10
  <div class="VcNoticeHeaderText">{{ titleText }}</div>
11
11
  </VcLayout>
12
12
  <VcLayout :class="`VcNoticeSubtitle ${flavor}`" column>{{ subtitleText }}</VcLayout>
@@ -36,18 +36,22 @@
36
36
  import VcModalContainer from "@/components/modal/elements/VcModalContainer.vue";
37
37
  import VcModalFooter from "@/components/modal/elements/VcModalFooter.vue";
38
38
  import VcLayout from "@/components/VcLayout/VcLayout.vue";
39
+ import VcImage from "@/components/VcImage/VcImage.vue";
39
40
 
40
41
  export default {
41
42
  name: "VcNoticeModal",
42
- components: {VcLayout, VcModalFooter, VcModalContainer},
43
+ components: {VcImage, VcLayout, VcModalFooter, VcModalContainer},
43
44
  props: {
44
45
  showDialog: {
45
46
  type: Boolean,
46
47
  required: true
47
48
  },
49
+ image: {
50
+ type: [String, Object],
51
+ },
48
52
  icon: {
49
- type: String,
50
- required: true,
53
+ type: [String, Object],
54
+ comment: 'deprecated'
51
55
  },
52
56
  titleText: {
53
57
  type: String,
@@ -84,6 +88,12 @@ export default {
84
88
  required: false
85
89
  },
86
90
  },
91
+ computed: {
92
+ currentImage() {
93
+ // for backward compatibility
94
+ return this.image || this.icon;
95
+ }
96
+ }
87
97
  }
88
98
  </script>
89
99
 
@@ -96,11 +106,11 @@ export default {
96
106
  &.responsive,
97
107
  &.sm,
98
108
  &.md {
99
- max-height: 160px;
109
+ height: 160px;
100
110
  }
101
111
 
102
112
  &.lg {
103
- max-height: 208px;
113
+ height: 208px;
104
114
  }
105
115
  }
106
116
 
@@ -113,6 +123,7 @@ export default {
113
123
 
114
124
  .VcNoticeHeader {
115
125
  text-align: center;
126
+ align-items: center;
116
127
  font-size: 18px;
117
128
  font-weight: 600;
118
129
  line-height: 28px;
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <div class="vc-stepper-container" data-qa="vc-steps-bar">
3
- <v-stepper class="vc-stepper"
4
- v-model="currentStep"
5
- vertical
6
- :data-qa="dataQa">
3
+ <v-stepper
4
+ class="vc-stepper"
5
+ v-model="currentStep"
6
+ vertical
7
+ :data-qa="dataQa"
8
+ >
7
9
  <div v-if="title" class="stepper-title">{{ title }}</div>
8
10
  <template v-for="(step, index) in steps">
9
11
  <v-stepper-step
@@ -12,7 +14,7 @@
12
14
  :complete="lastCompleted > index + 1"
13
15
  :step="index + 1"
14
16
  >
15
- {{ step.name }}
17
+ {{ step.title? step.title: step.name }}
16
18
  </v-stepper-step>
17
19
  </template>
18
20
  </v-stepper>
@@ -22,8 +24,8 @@
22
24
  <script>
23
25
  export default {
24
26
  name: "VcStepsBar",
25
- model:{
26
- prop: 'currentStep',
27
+ model: {
28
+ prop: "currentStep",
27
29
  },
28
30
  props: {
29
31
  currentStep: {
@@ -32,54 +34,54 @@ export default {
32
34
  },
33
35
  steps: {
34
36
  type: Array,
35
- validator: steps => steps.every(step => step.name),
36
- required: true
37
+ validator: (steps) => steps.every((step) => step.name),
38
+ required: true,
37
39
  },
38
40
  title: {
39
41
  type: String,
40
- default: ''
42
+ default: "",
41
43
  },
42
44
  dataQa: {
43
45
  type: String,
44
- default: 'vc-steps-bar'
45
- }
46
+ default: "vc-steps-bar",
47
+ },
46
48
  },
47
49
  data() {
48
50
  return {
49
51
  lastCompleted: 0,
50
- FIRST_STEP: 1
51
- }
52
+ FIRST_STEP: 1,
53
+ };
52
54
  },
53
55
  methods: {
54
56
  nextStep() {
55
57
  if (this.lastCompleted < this.currentStep) {
56
- this.lastCompleted = this.currentStep
58
+ this.lastCompleted = this.currentStep;
57
59
  }
58
60
  if (this.currentStep > this.steps.length) {
59
- this.shareStep(this.steps.length)
61
+ this.shareStep(this.steps.length);
60
62
  }
61
63
  },
62
64
  shareStep(step) {
63
- this.$emit('input', step)
64
- }
65
+ this.$emit("input", step);
66
+ },
65
67
  },
66
68
  watch: {
67
69
  currentStep: {
68
70
  handler(newVal, oldVal) {
69
71
  if (newVal > oldVal) {
70
- this.nextStep()
72
+ this.nextStep();
71
73
  }
72
74
  if (newVal < this.FIRST_STEP) {
73
- this.shareStep(this.FIRST_STEP)
75
+ this.shareStep(this.FIRST_STEP);
74
76
  }
75
- }
76
- }
77
+ },
78
+ },
77
79
  },
78
- }
80
+ };
79
81
  </script>
80
82
 
81
83
  <style lang="scss" scoped>
82
- @import '@/../styles/variables.scss';
84
+ @import "@/../styles/variables.scss";
83
85
  .vc-stepper-container {
84
86
  height: 100%;
85
87
  padding-block-start: var(--size-value4);
@@ -1,7 +1,7 @@
1
1
  import '@testing-library/jest-dom'
2
2
  import VcWizard from "./VcWizard";
3
3
  import Vuetify from 'vuetify'
4
- import {getByText, render} from "@testing-library/vue";
4
+ import {render} from "@testing-library/vue";
5
5
  import {within} from '@testing-library/dom'
6
6
 
7
7
  import init from "../../../../testing-library.config"
@@ -28,6 +28,7 @@ Playground.args = {
28
28
  onSubmit: action('submit'),
29
29
  steps: [
30
30
  {
31
+ title: 'Step title 1',
31
32
  name: 'Step name 1',
32
33
  description: 'A description for step 1',
33
34
  component: () => import('@/components/VcTextArea/VcTextArea.vue'),