@farm-investimentos/front-mfe-components-vue3 1.0.2 → 1.1.0

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 (37) hide show
  1. package/dist/front-mfe-components.common.js +30 -31
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +1 -1
  4. package/dist/front-mfe-components.umd.js +30 -31
  5. package/dist/front-mfe-components.umd.js.map +1 -1
  6. package/dist/front-mfe-components.umd.min.js +1 -1
  7. package/dist/front-mfe-components.umd.min.js.map +1 -1
  8. package/package.json +13 -13
  9. package/src/components/ButtonToggle/__tests__/{ButtonToggle.spec.js → ButtonToggle.spec.ts} +1 -1
  10. package/src/components/Buttons/ConfirmButton/__tests__/{ConfirmButton.spec.js → ConfirmButton.spec.ts} +1 -1
  11. package/src/components/Buttons/DangerButton/__tests__/{DangerButton.spec.js → DangerButton.spec.ts} +1 -1
  12. package/src/components/Buttons/DefaultButton/__tests__/DefaultButton.spec.ts +40 -0
  13. package/src/components/Buttons/ExportButton/__tests__/{ExportButton.spec.js → ExportButton.spec.ts} +11 -1
  14. package/src/components/Buttons/ImportButton/__tests__/{ImportButton.spec.js → ImportButton.spec.ts} +1 -1
  15. package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +3 -3
  16. package/src/components/Buttons/MultiImportButton/__tests__/MultiImportButton.spec.ts +26 -0
  17. package/src/components/Buttons/RemoveButton/__tests__/{RemoveButton.spec.js → RemoveButton.spec.ts} +1 -1
  18. package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.ts +37 -0
  19. package/src/components/DialogFooter/DialogFooter.scss +1 -1
  20. package/src/components/DialogFooter/__tests__/{DialogFooter.spec.js → DialogFooter.spec.ts} +1 -1
  21. package/src/components/Typography/OverlayText/OverlayText.vue +0 -1
  22. package/src/components/Typography/Typography.vue +0 -1
  23. package/src/components/Typography/__tests__/{Typography.spec.js → Typography.spec.ts} +5 -5
  24. package/src/components/ValueCaption/ValueCaption.stories.js +24 -0
  25. package/src/components/ValueCaption/ValueCaption.vue +2 -2
  26. package/src/components/ValueCaption/__tests__/ValueCaption.spec.ts +31 -0
  27. package/src/examples/Colors.stories.js +1 -1
  28. package/src/components/Buttons/DefaultButton/__tests__/DefaultButton.spec.js +0 -37
  29. package/src/components/Buttons/MultiImportButton/__tests__/MultiImportButton.spec.js +0 -15
  30. package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +0 -22
  31. package/src/components/ValueCaption/__tests__/ValueCaption.spec.js +0 -15
  32. /package/src/components/Typography/BodyText/__tests__/{BodyText.spec.js → BodyText.spec.ts} +0 -0
  33. /package/src/components/Typography/Caption/__tests__/{Caption.spec.js → Caption.spec.ts} +0 -0
  34. /package/src/components/Typography/Heading/__tests__/{Heading.spec.js → Heading.spec.ts} +0 -0
  35. /package/src/components/Typography/OverlayText/__tests__/{OverlayText.spec.js → OverlayText.spec.ts} +0 -0
  36. /package/src/components/Typography/Small/__tests__/{Small.spec.js → Small.spec.ts} +0 -0
  37. /package/src/components/Typography/Subtitle/__tests__/{Subtitle.spec.js → Subtitle.spec.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components-vue3",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,7 +32,7 @@
32
32
  "not dead"
33
33
  ],
34
34
  "dependencies": {
35
- "@storybook/test": "^8.0.0",
35
+ "@storybook/test": "^8.2.9",
36
36
  "@vuepic/vue-datepicker": "8.2.0",
37
37
  "core-js": "3.33.1",
38
38
  "text-mask-addons": "^3.8.0",
@@ -45,15 +45,15 @@
45
45
  "@babel/core": "7.17.9",
46
46
  "@babel/generator": "7.17.9",
47
47
  "@farm-investimentos/front-mfe-libs-ts": "3.0.5",
48
- "@storybook/addon-essentials": "^8.0.0",
49
- "@storybook/addon-interactions": "^8.0.0",
50
- "@storybook/addon-links": "^8.0.0",
51
- "@storybook/addon-mdx-gfm": "^8.0.0",
52
- "@storybook/blocks": "^8.0.0",
53
- "@storybook/manager-api": "^8.0.0",
54
- "@storybook/theming": "^8.0.0",
55
- "@storybook/vue3": "^8.0.0",
56
- "@storybook/vue3-vite": "^8.0.0",
48
+ "@storybook/addon-essentials": "^8.2.9",
49
+ "@storybook/addon-interactions": "^8.2.9",
50
+ "@storybook/addon-links": "^8.2.9",
51
+ "@storybook/addon-mdx-gfm": "^8.2.9",
52
+ "@storybook/blocks": "^8.2.9",
53
+ "@storybook/manager-api": "^8.2.9",
54
+ "@storybook/theming": "^8.2.9",
55
+ "@storybook/vue3": "^8.2.9",
56
+ "@storybook/vue3-vite": "^8.2.9",
57
57
  "@tsconfig/node18": "^18.2.2",
58
58
  "@types/jest": "^29.5.12",
59
59
  "@types/node": "^18.17.17",
@@ -84,12 +84,12 @@
84
84
  "react-dom": "^18.2.0",
85
85
  "sass": "~1.32.0",
86
86
  "sass-loader": "10.4.1",
87
- "storybook": "^8.0.0",
87
+ "storybook": "^8.2.9",
88
88
  "style-loader": "^3.3.3",
89
89
  "ts-jest": "^29.0.0",
90
90
  "typescript": "~4.1.5",
91
91
  "vite": "^4.4.9",
92
- "vue": "3.4.21",
92
+ "vue": "3.4.37",
93
93
  "vue-loader": "^16.8.3",
94
94
  "vue-tsc": "^1.8.11",
95
95
  "webpack-cli": "^5.1.4"
@@ -20,7 +20,7 @@ describe('ButtonToggle component', () => {
20
20
  });
21
21
 
22
22
  test('Default buttons value', () => {
23
- const wrapper1 = shallowMount(ButtonToggle, {});
23
+ const wrapper1: any = shallowMount(ButtonToggle, {});
24
24
  expect(wrapper1.vm.buttons.length).toEqual(0);
25
25
  });
26
26
 
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import ConfirmButton from '../ConfirmButton';
3
+ import ConfirmButton from '../ConfirmButton.vue';
4
4
 
5
5
  describe('ConfirmButton component', () => {
6
6
  let wrapper;
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import DangerButton from '../DangerButton';
3
+ import DangerButton from '../DangerButton.vue';
4
4
 
5
5
  describe('DangerButton component', () => {
6
6
  let wrapper;
@@ -0,0 +1,40 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import DefaultButton from '../DefaultButton.vue';
4
+
5
+ describe('DefaultButton component', () => {
6
+ let wrapper;
7
+ let component;
8
+
9
+ beforeEach(() => {
10
+ wrapper = shallowMount(DefaultButton);
11
+ component = wrapper.vm;
12
+ });
13
+
14
+ test('Created hook', () => {
15
+ expect(wrapper).toBeDefined();
16
+ });
17
+
18
+ describe('computed properties', () => {
19
+ describe('isRound', () => {
20
+ it('get false', () => {
21
+ expect(component.isRound).toBeFalsy();
22
+ });
23
+
24
+ it('get truthy', async () => {
25
+ await wrapper.setProps({ icon: true });
26
+ expect(component.isRound).toBeTruthy();
27
+ });
28
+ });
29
+ describe('classes', () => {
30
+ it('get ', () => {
31
+ expect(component.classes).toBeDefined();
32
+ });
33
+
34
+ it('get with props set', async () => {
35
+ await wrapper.setProps({ outlined: true, plain: true, disabled: true });
36
+ expect(component.classes['farm-btn--outlined']).toBeTruthy();
37
+ });
38
+ });
39
+ });
40
+ });
@@ -1,15 +1,25 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import ExportButton from '../ExportButton';
3
+ import ExportButton from '../ExportButton.vue';
4
4
 
5
5
  describe('ExportButton component', () => {
6
6
  let wrapper;
7
+ let component;
7
8
 
8
9
  beforeEach(() => {
9
10
  wrapper = shallowMount(ExportButton);
11
+ component = wrapper.vm;
10
12
  });
11
13
 
12
14
  test('Created hook', () => {
13
15
  expect(wrapper).toBeDefined();
14
16
  });
17
+
18
+ describe('Methods', () => {
19
+ it('Should emit event', () => {
20
+ component.onClick();
21
+ expect(wrapper.emitted().onClick).toBeDefined();
22
+ });
23
+ });
24
+
15
25
  });
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import ImportButton from '../ImportButton';
3
+ import ImportButton from '../ImportButton.vue';
4
4
 
5
5
  describe('ImportButton component', () => {
6
6
  let wrapper;
@@ -25,8 +25,8 @@
25
25
  import { PropType } from 'vue';
26
26
 
27
27
  export interface IImportOption {
28
- title: String;
29
- listenerKey: String;
28
+ title: string;
29
+ listenerKey: string;
30
30
  }
31
31
 
32
32
  export default {
@@ -46,7 +46,7 @@ export default {
46
46
  };
47
47
  },
48
48
  methods: {
49
- onClick(key) {
49
+ onClick(key: string) {
50
50
  this.$emit('onClick', key);
51
51
  },
52
52
  },
@@ -0,0 +1,26 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import MultiImportButton from '../MultiImportButton.vue';
4
+
5
+ describe('MultiImportButton component', () => {
6
+ let wrapper;
7
+ let component;
8
+
9
+ beforeEach(() => {
10
+ wrapper = shallowMount(MultiImportButton);
11
+ component = wrapper.vm;
12
+ });
13
+
14
+ test('Created hook', () => {
15
+ expect(wrapper).toBeDefined();
16
+ component = wrapper.vm;
17
+ });
18
+
19
+ describe('Methods', () => {
20
+ it('Should emit event', () => {
21
+ component.onClick();
22
+ expect(wrapper.emitted().onClick).toBeDefined();
23
+ });
24
+ });
25
+
26
+ });
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import RemoveButton from '../RemoveButton';
3
+ import RemoveButton from '../RemoveButton.vue';
4
4
 
5
5
  describe('RemoveButton component', () => {
6
6
  let wrapper;
@@ -0,0 +1,37 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import ToggleButton from '../ToggleButton.vue';
4
+
5
+ describe('ToggleButton component', () => {
6
+ let wrapper;
7
+ let component;
8
+
9
+ beforeEach(() => {
10
+ wrapper = shallowMount(ToggleButton);
11
+ component = wrapper.vm;
12
+ });
13
+
14
+ test('Created hook', () => {
15
+ expect(wrapper).toBeDefined();
16
+ });
17
+
18
+ describe('Methods', () => {
19
+ it('Should handle click', () => {
20
+ component.onClick();
21
+ expect(component.open).toBeTruthy();
22
+ });
23
+ });
24
+
25
+ describe('computed properties', () => {
26
+ describe('prepend', () => {
27
+ it('get truthy', () => {
28
+ expect(component.prepend).toBeTruthy();
29
+ });
30
+
31
+ it('get false', async () => {
32
+ await wrapper.setProps({ position: 'right' });
33
+ expect(component.isRound).toBeFalsy();
34
+ });
35
+ });
36
+ });
37
+ });
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  .farm-btn {
13
- margin-left: gutter('none');
13
+ margin-left: gutter('sm');
14
14
  margin-top: 0;
15
15
 
16
16
  .farm-icon {
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import DialogFooter from '../DialogFooter';
3
+ import DialogFooter from '../DialogFooter.vue';
4
4
 
5
5
  describe('DialogFooter component', () => {
6
6
  let wrapper;
@@ -11,7 +11,6 @@
11
11
  </template>
12
12
  <script lang="ts">
13
13
 
14
-
15
14
  export default {
16
15
  inheritAttrs: true,
17
16
  name: 'farm-overlaytext',
@@ -119,7 +119,6 @@ export default {
119
119
  style.value.lineHeight = lineHeight.value;
120
120
  }
121
121
 
122
- // eslint-disable-next-line
123
122
  return {
124
123
  style,
125
124
  isSizeFromBreakpoints,
@@ -1,6 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import Typography from '../Typography';
3
+ import Typography from '../Typography.vue';
4
4
 
5
5
  describe('Typography component', () => {
6
6
  let wrapper;
@@ -30,7 +30,7 @@ describe('Typography component', () => {
30
30
  expect(component.isSizeFromBreakpoints).toBeFalsy();
31
31
  });
32
32
 
33
- it('Should have isSizeFromBreakpoints truthy', async () => {
33
+ it('Should have isSizeFromBreakpoints truthy', () => {
34
34
  const wrapperTest = shallowMount(Typography, {
35
35
  propsData: {
36
36
  size: 'lg',
@@ -45,14 +45,14 @@ describe('Typography component', () => {
45
45
  });
46
46
 
47
47
  describe('Prop data', () => {
48
- it('Should have li tag', async () => {
48
+ it('Should have li tag', () => {
49
49
  expect(component.tag).toEqual('li');
50
50
  });
51
51
 
52
- it('Should not allow invalid html tag', async () => {
52
+ it('Should not allow invalid html tag', () => {
53
53
  const wrapperTest = shallowMount(Typography, {
54
54
  propsData: {
55
- tag: 'section',
55
+ tag: 'section' as any,
56
56
  },
57
57
  });
58
58
  expect(wrapperTest.vm.tag).toEqual('p');
@@ -58,3 +58,27 @@ export const Colors = () => ({
58
58
  </farm-valuecaption>
59
59
  </div>`,
60
60
  });
61
+
62
+ export const NoTitle = () => ({
63
+ template: `
64
+ <farm-valuecaption
65
+ icon="account-box-outline"
66
+ >
67
+ <template v-slot:subtitle>
68
+ R$ 1.000,00
69
+ </template>
70
+ </farm-valuecaption>
71
+ `,
72
+ });
73
+
74
+ export const NoSubTitle = () => ({
75
+ template: `
76
+ <farm-valuecaption
77
+ icon="account-box-outline"
78
+ >
79
+ <template v-slot:title>
80
+ Upper Line Text
81
+ </template>
82
+ </farm-valuecaption>
83
+ `,
84
+ });
@@ -50,8 +50,8 @@ export default {
50
50
  },
51
51
 
52
52
  setup(_, { slots }) {
53
- const hasTitle = computed(() => slots.title);
54
- const hasSubtitle = computed(() => slots.subtitle);
53
+ const hasTitle = computed(() => !!slots.title);
54
+ const hasSubtitle = computed(() => !!slots.subtitle);
55
55
 
56
56
  return { hasSubtitle, hasTitle };
57
57
  },
@@ -0,0 +1,31 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import ValueCaption from '../ValueCaption.vue';
4
+
5
+ describe('ValueCaption component', () => {
6
+ test('Created hook', () => {
7
+ const wrapper = shallowMount(ValueCaption);
8
+ expect(wrapper).toBeDefined();
9
+ expect(wrapper.vm.hasTitle).toBeFalsy();
10
+ });
11
+
12
+ describe('Computed properties', () => {
13
+ it('hasTitle truthy', () => {
14
+ const wrapper = shallowMount(ValueCaption, {
15
+ slots: {
16
+ title: '',
17
+ },
18
+ });
19
+ expect(wrapper.vm.hasTitle).toBeTruthy();
20
+ });
21
+
22
+ it('hasSubtitle truthy', () => {
23
+ const wrapper = shallowMount(ValueCaption, {
24
+ slots: {
25
+ subtitle: '',
26
+ },
27
+ });
28
+ expect(wrapper.vm.hasSubtitle).toBeTruthy();
29
+ });
30
+ });
31
+ });
@@ -87,7 +87,7 @@ export const CssVariables = () => ({
87
87
  <farm-heading :type="5">{{ key }}</farm-heading>
88
88
  <span :style="{ backgroundColor: baseThemeColors[key] }">Base <span>--farm-{{ key }}-base</span></span>
89
89
  <span :style="{ backgroundColor: variationThemeColors[key + '-lighten'] }">Lighten<span>--farm-{{ key }}-lighten</span></span>
90
- <span :style="{ backgroundColor: variationThemeColors[key + '-darken'], color: 'white' }">Darken: <span>--farm-{{ key }}-darken</span></span>
90
+ <span :style="{ backgroundColor: variationThemeColors[key + '-darken'], color: 'white' }">Darken <span>--farm-{{ key }}-darken</span></span>
91
91
  </div>
92
92
 
93
93
  <div>
@@ -1,37 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
-
3
- import DefaultButton from '../DefaultButton.vue';
4
-
5
- describe('DefaultButton component', () => {
6
- let wrapper;
7
- let component;
8
-
9
- beforeEach(() => {
10
- wrapper = shallowMount(DefaultButton);
11
- component = wrapper.vm;
12
- });
13
-
14
- test('Created hook', () => {
15
- expect(wrapper).toBeDefined();
16
- });
17
-
18
- describe('computed properties', () => {
19
- it('get isRound false', () => {
20
- expect(component.isRound).toBeFalsy();
21
- });
22
-
23
- it('get isRound false', async () => {
24
- await wrapper.setProps({ icon: true });
25
- expect(component.isRound).toBeTruthy();
26
- });
27
-
28
- it('get classes', () => {
29
- expect(component.classes).toBeDefined();
30
- });
31
-
32
- it('get classes with props set', async () => {
33
- await wrapper.setProps({ outlined: true, plain: true, disabled: true });
34
- expect(component.classes['farm-btn--outlined']).toBeTruthy();
35
- });
36
- });
37
- });
@@ -1,15 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
-
3
- import MultiImportButton from '../MultiImportButton';
4
-
5
- describe('MultiImportButton component', () => {
6
- let wrapper;
7
-
8
- beforeEach(() => {
9
- wrapper = shallowMount(MultiImportButton);
10
- });
11
-
12
- test('Created hook', () => {
13
- expect(wrapper).toBeDefined();
14
- });
15
- });
@@ -1,22 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
-
3
- import ToggleButton from '../ToggleButton';
4
-
5
- describe('ToggleButton component', () => {
6
- let wrapper;
7
-
8
- beforeEach(() => {
9
- wrapper = shallowMount(ToggleButton);
10
- });
11
-
12
- test('Created hook', () => {
13
- expect(wrapper).toBeDefined();
14
- });
15
-
16
- describe('Methods', () => {
17
- it('Should handle click', () => {
18
- wrapper.vm.onClick();
19
- expect(wrapper.vm.open).toBeTruthy();
20
- });
21
- });
22
- });
@@ -1,15 +0,0 @@
1
- import { shallowMount } from '@vue/test-utils';
2
-
3
- import ValueCaption from '../ValueCaption.vue';
4
-
5
- describe('ValueCaption component', () => {
6
- let wrapper;
7
-
8
- beforeEach(() => {
9
- wrapper = shallowMount(ValueCaption);
10
- });
11
-
12
- test('Created hook', () => {
13
- expect(wrapper).toBeDefined();
14
- });
15
- });