@vcita/design-system 0.2.5 → 0.2.7

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 (23) hide show
  1. package/config/locales/ds.en.yml +3 -0
  2. package/dist/@vcita/design-system.esm.js +1066 -554
  3. package/dist/@vcita/design-system.min.js +1 -1
  4. package/dist/@vcita/design-system.ssr.js +950 -466
  5. package/package.json +1 -1
  6. package/src/components/index.js +4 -2
  7. package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.spec.js +0 -0
  8. package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.stories.js +0 -0
  9. package/src/components/{Wizard → wizard}/VcMobileWizardProgress/VcMobileWizardProgress.vue +4 -0
  10. package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.spec.js +0 -0
  11. package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.stories.js +0 -0
  12. package/src/components/{Wizard/VcSteperContant → wizard/VcSteperContent}/VcStepperContent.vue +65 -51
  13. package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.spec.js +0 -0
  14. package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.stories.js +0 -0
  15. package/src/components/{Wizard → wizard}/VcStepsBar/VcStepsBar.vue +6 -4
  16. package/src/components/wizard/VcWizard/VcWizard.spec.js +155 -0
  17. package/src/components/wizard/VcWizard/VcWizard.stories.js +115 -0
  18. package/src/components/wizard/VcWizard/VcWizard.vue +144 -0
  19. package/src/components/wizard/VcWizard/demoWizardPage.vue +29 -0
  20. package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.spec.js +100 -0
  21. package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.stories.js +67 -0
  22. package/src/components/wizard/VcWizardCtaContainer/VcWizardCtaContainer.vue +95 -0
  23. package/src/scss/mixins.scss +6 -0
@@ -0,0 +1,100 @@
1
+ import '@testing-library/jest-dom'
2
+ import VcWizardCtaContainer from "./VcWizardCtaContainer.vue";
3
+ import Vuetify from 'vuetify'
4
+ import {render} from "@testing-library/vue";
5
+ import init from "../../../../testing-library.config";
6
+ import userEvent from "@testing-library/user-event";
7
+
8
+ init();
9
+
10
+ describe("VcWizardCtaContainer.vue", () => {
11
+
12
+ const renderWithVuetify = (component, options, callback) => {
13
+ const root = document.createElement('div')
14
+ root.setAttribute('data-app', 'true')
15
+
16
+ return render(
17
+ component,
18
+ {
19
+ container: document.body.appendChild(root),
20
+ // for Vuetify components that use the vuetify instance property
21
+ vuetify: new Vuetify(),
22
+ ...options,
23
+ mocks: {},
24
+ },
25
+ callback,
26
+ )
27
+ }
28
+
29
+ it("mounts", async () => {
30
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
31
+ const {container} = renderWithVuetify(VcWizardCtaContainer, {
32
+ props: {
33
+ isBackDisplayed: true,
34
+ isNextButtonDisabled: false,
35
+ backButtonLabel: "back",
36
+ nextButtonLabel: "next",
37
+ }
38
+ })
39
+
40
+ // Expect options: https://github.com/testing-library/jest-dom
41
+ expect(container).toHaveAttribute('data-app', 'true');
42
+ });
43
+
44
+ it("displays correctly", async () => {
45
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
46
+ const {getByText, getByTestId} = renderWithVuetify(VcWizardCtaContainer, {
47
+ props: {
48
+ isBackDisplayed: true,
49
+ isNextButtonDisabled: false,
50
+ backButtonLabel: "back",
51
+ nextButtonLabel: "next",
52
+ }
53
+ })
54
+
55
+ expect(getByTestId("wizard-back-button")).toBeInTheDocument()
56
+ expect(getByTestId("wizard-next-button")).toBeInTheDocument()
57
+ expect(getByText("back")).toBeInTheDocument();
58
+ expect(getByText("next")).toBeInTheDocument();
59
+ // Expect options: https://github.com/testing-library/jest-dom
60
+ });
61
+ it("removes back button correctly and disables the next button", async () => {
62
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
63
+ const {getByTestId, queryByTestId, emitted } = renderWithVuetify(VcWizardCtaContainer, {
64
+ props: {
65
+ isBackDisplayed: false,
66
+ isNextButtonDisabled: true,
67
+ backButtonLabel: "back",
68
+ nextButtonLabel: "next",
69
+ }
70
+ })
71
+ const nextButton = getByTestId("wizard-next-button")
72
+ const backButton = queryByTestId("wizard-back-button")
73
+ expect(backButton).toBeFalsy()
74
+ expect(nextButton).toHaveClass('v-btn--disabled');
75
+ await userEvent.click(nextButton);
76
+ expect(emitted().onNextPressed).toBeFalsy();
77
+ // Expect options: https://github.com/testing-library/jest-dom
78
+ });
79
+ it("emits events correctly", async () => {
80
+ // Queries: https://testing-library.com/docs/queries/about#types-of-queries
81
+ const {emitted, getByTestId} = renderWithVuetify(VcWizardCtaContainer, {
82
+ props: {
83
+ isBackDisplayed: true,
84
+ isNextButtonDisabled: false,
85
+ backButtonLabel: "back",
86
+ nextButtonLabel: "next",
87
+ }
88
+ })
89
+ const nextButton = getByTestId("wizard-next-button")
90
+ const backButton = getByTestId("wizard-back-button")
91
+ // Expect options: https://github.com/testing-library/jest-dom
92
+ await userEvent.click(nextButton);
93
+ await userEvent.click(backButton);
94
+ expect(emitted().onBackPressed.length).toBe(1);
95
+ expect(emitted().onNextPressed.length).toBe(1);
96
+ });
97
+
98
+
99
+
100
+ });
@@ -0,0 +1,67 @@
1
+ import VcWizardCtaContainerCmp from './VcWizardCtaContainer';
2
+
3
+ const GeneralTemplate = (args, {argTypes}) => ({
4
+ components: {VcWizardCtaContainer: VcWizardCtaContainerCmp},
5
+ props: Object.keys(argTypes),
6
+ template: `
7
+ <div
8
+
9
+ >
10
+ <br/>
11
+ <br/>
12
+ <br/>
13
+ <br/>
14
+ <br/>
15
+ <br/>
16
+ <br/>
17
+ <br/>
18
+ <br/>
19
+ <br/>
20
+ <br/>
21
+ <br/>
22
+ <VcWizardCtaContainer
23
+ style="border: solid 1px black; min-height: 80px; padding: 20px;"
24
+ :isBackDisplayed="isBackDisplayed"
25
+ :isNextButtonDisabled="isNextButtonDisabled"
26
+ :backButtonLabel="backButtonLabel"
27
+ :nextButtonLabel="nextButtonLabel"
28
+ >
29
+ </VcWizardCtaContainer>
30
+ </div>`
31
+ })
32
+
33
+ export const Playground = GeneralTemplate.bind({});
34
+
35
+ // Set default values
36
+ Playground.args = {
37
+ isBackDisplayed: true,
38
+ isNextButtonDisabled: false,
39
+ backButtonLabel: "back",
40
+ nextButtonLabel: "next",
41
+ }
42
+
43
+ export default {
44
+ title: 'Wizard / wizard cta container',
45
+ id: 'VcWizardCtaContainer',
46
+ component: VcWizardCtaContainerCmp,
47
+ argTypes: {
48
+ backButtonLabel: {
49
+ options: ['back', 'revert'],
50
+ control: {type: 'radio'}
51
+ },
52
+ nextButtonLabel: {
53
+ options: ['next', 'confirm'],
54
+ control: {type: 'radio'}
55
+ },
56
+ },
57
+ parameters: {
58
+ design: {
59
+ type: 'figma',
60
+ url: 'https://www.figma.com/file/xIOY6fBoA1wpy1tHv3i5js/vcita---ui-library?node-id=6718%3A80517',
61
+ },
62
+ status: {
63
+ type: 'releaseCandidate', // 'beta' | 'stable' | 'deprecated' | 'releaseCandidate'
64
+ url: 'https://vuetifyjs.com/en/components/buttons/', // will make the tag a link
65
+ }
66
+ },
67
+ };
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <VcLayout class="wizard-cta-container" align-center justify-end>
3
+ <vc-button
4
+ class="wizard-cta-button back-button"
5
+ color="white"
6
+ :pill="true"
7
+ :data-qa="`${dataQa ? dataQa + '-' : ''}wizard-back-button`"
8
+ v-if="isBackDisplayed"
9
+ @click="$emit('onBackPressed')"
10
+ >
11
+ {{backButtonLabel}}
12
+ </vc-button>
13
+ <vc-button
14
+ class="wizard-cta-button next-button"
15
+ :pill="true"
16
+ :data-qa="`${dataQa ? dataQa + '-' : ''}wizard-next-button`"
17
+ :disabled="isNextButtonDisabled"
18
+ @click="$emit('onNextPressed')"
19
+ >
20
+ {{nextButtonLabel}}
21
+ </vc-button>
22
+ </VcLayout>
23
+ </template>
24
+
25
+ <script>
26
+ import VcButton from "@/components/VcButton/VcButton.vue";
27
+ import VcLayout from "@/components/VcLayout/VcLayout.vue";
28
+
29
+ export default {
30
+ name: "VcWizardCtaContainer",
31
+ components: {
32
+ VcButton,
33
+ VcLayout,
34
+ },
35
+ props: {
36
+ isBackDisplayed: {
37
+ type: Boolean,
38
+ required: true
39
+ },
40
+ isNextButtonDisabled: {
41
+ type: Boolean,
42
+ required: true
43
+ },
44
+ backButtonLabel: {
45
+ type: String,
46
+ required: true
47
+ },
48
+ nextButtonLabel: {
49
+ type: String,
50
+ required: true
51
+ },
52
+ dataQa: {
53
+ type: String,
54
+ default: '',
55
+ }
56
+ },
57
+ };
58
+ </script>
59
+
60
+ <style lang="scss" scoped>
61
+
62
+ @import "src/scss/i18n-mixins";
63
+ @import "src/scss/mixins";
64
+ @import '@/../styles/variables.scss';
65
+ .wizard-cta-container {
66
+ background-color: white;
67
+ position: sticky;
68
+ bottom: 0;
69
+ left: 0;
70
+ width: 100%;
71
+ height: var(--size-value18);
72
+ max-height: var(--size-value18);
73
+ padding: var(--size-value3) var(--size-value4);
74
+ border-top: 1px solid var(--gray-lighten-1);
75
+ @include md-and-up {
76
+ border-top: revert;
77
+ position: static;
78
+ padding: var(--size-value5);
79
+ width: 100%;
80
+ transform: revert;
81
+ }
82
+ }
83
+ .wizard-cta-button {
84
+ flex: 1;
85
+ min-height: var(--size-value12);
86
+ @include md-and-up {
87
+ flex: revert;
88
+ min-height: var(--size-value10);
89
+ }
90
+ }
91
+
92
+ .wizard-cta-button + .wizard-cta-button {
93
+ margin-inline-start: var(--size-value3);
94
+ }
95
+ </style>
@@ -1,10 +1,16 @@
1
1
  $mdUp: 960px;
2
+ $lgUp: 972px;
2
3
 
3
4
  @mixin md-and-up {
4
5
  @media screen and (min-width: $mdUp) {
5
6
  @content;
6
7
  }
7
8
  }
9
+ @mixin lg-and-up {
10
+ @media screen and (min-width: $lgUp) {
11
+ @content;
12
+ }
13
+ }
8
14
 
9
15
  @mixin hide-scrollbar {
10
16
  -webkit-overflow-scrolling: touch;