@farm-investimentos/front-mfe-components 3.4.10 → 3.4.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "3.4.10",
3
+ "version": "3.4.13",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -25,7 +25,8 @@
25
25
  "sass": "1.32.13",
26
26
  "sass-loader": "^10.1.1",
27
27
  "vue": "^2.6.11",
28
- "vuetify": "^2.5.7"
28
+ "vuetify": "^2.5.7",
29
+ "vuetify-dialog": "^2.0.16"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@socheatsok78/storybook-addon-vuetify": "^0.1.8",
@@ -4,6 +4,11 @@
4
4
  background: #ffffff;
5
5
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
6
6
  border-radius: 5px;
7
+
8
+ &.card-context--outlined {
9
+ box-shadow: none;
10
+ border: 1px solid var(--v-gray-lighten2);
11
+ }
7
12
  }
8
13
 
9
14
  .card-context.height-full {
@@ -29,12 +34,11 @@
29
34
  color: #5c5c5c;
30
35
  margin: 0;
31
36
  font-size: 0.75rem;
32
- }
33
-
34
- .card-context-title.bold {
35
- font-size: 0.875rem;
36
- font-weight: bold;
37
- color: #1c1c1c;
37
+ &.card-context-content--bold {
38
+ font-size: 0.875rem;
39
+ font-weight: bold;
40
+ color: #1c1c1c;
41
+ }
38
42
  }
39
43
 
40
44
  .card-context-body {
@@ -1,8 +1,19 @@
1
1
  import CardContext from './CardContext.vue';
2
2
 
3
+
3
4
  export default {
4
5
  title: 'API/CardContext',
5
6
  component: CardContext,
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: `Card Context<br />
11
+ selector: <em>farm-card-context</em>
12
+ `,
13
+ },
14
+ },
15
+ viewMode: 'docs',
16
+ },
6
17
  };
7
18
 
8
19
  export const Primary = () => ({
@@ -50,8 +61,18 @@ export const WithError = () => ({
50
61
  `,
51
62
  });
52
63
 
64
+ export const NoIcon = () => ({
65
+ components: { CardContext },
66
+ template: `
67
+ <CardContext title="Titulo do Card">
68
+ <p>Conteúdo do Card</p>
69
+ </CardContext>
70
+ `,
71
+ });
72
+
53
73
  Primary.storyName = 'Básico';
54
74
  Secondary.storyName = 'Título em Bold';
55
75
  WithLoading.storyName = 'Com Loading';
56
76
  WithLoadingLarge.storyName = 'Com Loading Large';
57
77
  WithError.storyName = 'Com Erro';
78
+ NoIcon.storyName = 'No icon';
@@ -1,9 +1,15 @@
1
1
  <template>
2
- <div :class="isHeightFull">
3
- <div class="card-context-header" v-if="isSuccess">
4
- <IconBox :icon="icon" />
2
+ <div
3
+ :class="{
4
+ 'card-context': true,
5
+ 'height-full': this.full,
6
+ 'card-context--outlined': this.outlined,
7
+ }"
8
+ >
9
+ <div class="card-context-header" v-if="isSuccess && title">
10
+ <IconBox :icon="icon" v-if="icon" />
5
11
  <div class="card-context-content">
6
- <p :class="isBold">
12
+ <p :class="{ 'card-context-title': true, 'card-context-content--bold': bold }">
7
13
  {{ title }}
8
14
  </p>
9
15
  </div>
@@ -52,7 +58,7 @@ export default Vue.extend({
52
58
  */
53
59
  icon: {
54
60
  type: String,
55
- require: true,
61
+ default: null,
56
62
  },
57
63
  /**
58
64
  * Show loader
@@ -80,20 +86,21 @@ export default Vue.extend({
80
86
  default: 'Ocorreu um erro',
81
87
  },
82
88
  /**
83
- * Is full
89
+ * Is full
84
90
  */
85
91
  full: {
86
92
  type: Boolean,
87
93
  default: false,
88
94
  },
95
+ /**
96
+ * Is outlined
97
+ */
98
+ outlined: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
89
102
  },
90
103
  computed: {
91
- isBold() {
92
- return this.bold ? 'card-context-title bold' : 'card-context-title';
93
- },
94
- isHeightFull() {
95
- return this.full ? 'card-context height-full' : 'card-context';
96
- },
97
104
  isSuccess() {
98
105
  return !this.isLoading && !this.isError;
99
106
  },
@@ -21,27 +21,6 @@ describe('CardContext component', () => {
21
21
  });
22
22
 
23
23
  describe('Computed properties', () => {
24
- it('Should compute isBold for false', () => {
25
- expect(component.isBold).toEqual('card-context-title');
26
- });
27
-
28
- it('Should compute isBold for true', async () => {
29
- await wrapper.setProps({
30
- bold: true,
31
- });
32
- expect(component.isBold).toEqual('card-context-title bold');
33
- });
34
-
35
- it('Should compute isHeightFull for false', () => {
36
- expect(component.isHeightFull).toEqual('card-context');
37
- });
38
-
39
- it('Should compute isHeightFull for true', async () => {
40
- await wrapper.setProps({
41
- full: true,
42
- });
43
- expect(component.isHeightFull).toEqual('card-context height-full');
44
- });
45
24
 
46
25
  it('Should compute isLargeLoading for false', () => {
47
26
  expect(component.isLargeLoading).toEqual('small');
@@ -268,16 +268,20 @@ export default Vue.extend({
268
268
  const label = this.getItemLabel(item);
269
269
  return label.toLowerCase().includes(search.toLowerCase());
270
270
  },
271
- clearTextField(event) {
272
- if (event.key === "Delete" || event.key === "Backspace") {
271
+ clearTextField(event) {
272
+ if (event.key === 'Delete' || event.key === 'Backspace') {
273
273
  this.selectedItem = null;
274
274
  }
275
- }
275
+ },
276
276
  },
277
277
  });
278
278
  </script>
279
279
  <style lang="scss" scoped>
280
- .v-text-field::v-deep input {
281
- cursor: pointer;
280
+ .v-text-field::v-deep {
281
+ margin-top: 0;
282
+ padding-top: 0;
283
+ input {
284
+ cursor: pointer;
285
+ }
282
286
  }
283
287
  </style>
@@ -0,0 +1,51 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import { ConfirmButton } from '../main';
3
+
4
+ export default {
5
+ title: 'Examples/ConfirmDialog',
6
+ decorators: [withDesign],
7
+ parameters: {
8
+ viewMode: 'docs',
9
+ docs: {
10
+ description: {
11
+ component: `ConfirmDialog created by vuetify-dialog`,
12
+ },
13
+ },
14
+ },
15
+ };
16
+
17
+ export const ConfirmDialog = () => ({
18
+ components: {
19
+ ConfirmButton,
20
+ },
21
+ methods: {
22
+ openDialog() {
23
+ this.$dialog.confirm({
24
+ text: `Deseja realmente sair?`,
25
+ title: 'Sair',
26
+ actions: {
27
+ false: {
28
+ text: 'Cancelar',
29
+ color: 'primary',
30
+ },
31
+ true: {
32
+ text: 'Sim',
33
+ color: 'secondary',
34
+ handle: () => {
35
+ this.$emit('onLogout');
36
+ },
37
+ },
38
+ },
39
+ });
40
+ },
41
+ },
42
+ template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
43
+ <ConfirmButton @click="openDialog">
44
+ Open
45
+ </ConfirmButton>
46
+ </div>`,
47
+ });
48
+
49
+ ConfirmDialog.story = {
50
+ name: 'ConfirmDialog',
51
+ };