@farm-investimentos/front-mfe-components 3.5.2 → 3.6.1

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.5.2",
3
+ "version": "3.6.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -20,17 +20,19 @@
20
20
  class="v-btn--responsive mt-14 mt-sm-8"
21
21
  @click="onFilterClick"
22
22
  >
23
- <v-icon color="white" class="mr-2">mdi-filter</v-icon>
24
- Filtrar
23
+ <v-icon color="white" class="mr-2">{{ extraFiltersBtnIcon }}</v-icon>
24
+ {{ extraFiltersBtnLabel }}
25
25
  </v-btn>
26
26
  </section>
27
27
  </template>
28
28
 
29
29
  <script>
30
+ import Vue from 'vue';
30
31
  import { VBtn } from 'vuetify/lib/components/VBtn';
31
32
  import { VTextField } from 'vuetify/lib/components/VTextField';
32
33
  import { VIcon } from 'vuetify/lib/components/VIcon';
33
- export default {
34
+
35
+ export default Vue.extend({
34
36
  name: 'MainFilter',
35
37
  components: {
36
38
  VTextField,
@@ -62,6 +64,10 @@ export default {
62
64
  type: String,
63
65
  default: () => '',
64
66
  },
67
+ showFilters: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
65
71
  },
66
72
 
67
73
  watch: {
@@ -69,6 +75,14 @@ export default {
69
75
  this.inputValue = newValue;
70
76
  },
71
77
  },
78
+ computed: {
79
+ extraFiltersBtnLabel() {
80
+ return this.showFilters ? 'Esconder filtros' : 'Ver filtros';
81
+ },
82
+ extraFiltersBtnIcon() {
83
+ return this.showFilters ? 'mdi-filter-off' : 'mdi-filter';
84
+ },
85
+ },
72
86
  data() {
73
87
  return {
74
88
  timer: null,
@@ -101,9 +115,8 @@ export default {
101
115
  }, 400);
102
116
  },
103
117
  },
104
- };
118
+ });
105
119
  </script>
106
-
107
120
  <style scoped lang="scss">
108
121
  @import './MainFilter.scss';
109
122
  </style>
@@ -20,4 +20,22 @@ describe('MainFilter component', () => {
20
20
  expect(wrapper.emitted().onClick).toBeTruthy();
21
21
  });
22
22
  });
23
+
24
+ describe('computed properties', () => {
25
+ it('get extraFiltersBtnLabel', async () => {
26
+ expect(component.extraFiltersBtnLabel).toEqual('Ver filtros');
27
+ await wrapper.setProps({
28
+ showFilters: true,
29
+ });
30
+ expect(component.extraFiltersBtnLabel).not.toEqual('Ver filtros');
31
+ });
32
+
33
+ it('get extraFiltersBtnIcon', async () => {
34
+ expect(component.extraFiltersBtnIcon).toEqual('mdi-filter');
35
+ await wrapper.setProps({
36
+ showFilters: true,
37
+ });
38
+ expect(component.extraFiltersBtnIcon).toEqual('mdi-filter-off');
39
+ });
40
+ });
23
41
  });
@@ -0,0 +1,29 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import { MainFilter } from '../main';
3
+
4
+ export default {
5
+ title: 'Examples/MainFilter',
6
+ decorators: [withDesign],
7
+ component: MainFilter,
8
+ };
9
+
10
+ export const MainFilters = () => ({
11
+ /*
12
+ * How to toggle filters
13
+ */
14
+ components: {
15
+ MainFilter,
16
+ },
17
+ data() {
18
+ return {
19
+ showFilters: false,
20
+ items: [1, 2, 3, 4, 5],
21
+ };
22
+ },
23
+ template: `<div style="max-width: 480px">
24
+ <MainFilter @onClick="showFilters = !showFilters" :showFilters="showFilters" />
25
+ <section v-if="showFilters">
26
+ <v-select :items="items" />
27
+ </section>
28
+ </div>`,
29
+ });
@@ -34,7 +34,129 @@ export const Modal = () => ({
34
34
  </div>`,
35
35
  });
36
36
 
37
- // Modal.storyName = 'Básico';
37
+ export const ModalSmall = () => ({
38
+ components: {
39
+ DialogHeader,
40
+ DialogFooter,
41
+ },
42
+ data() {
43
+ return {
44
+ showModalSmall: false,
45
+ };
46
+ },
47
+ template: `<div>
48
+ <v-dialog content-class="modal-default modal-default-small" v-model="showModalSmall">
49
+ <DialogHeader title="Exemplo" @onClose="showModalSmall = false;" />
50
+ <v-main class="pa-6 pt-12">
51
+ Place dialog content here!
52
+ </v-main>
53
+ <DialogFooter :hasConfirm="false" @onClose="showModalSmall = false;" />
54
+ </v-dialog>
55
+ <v-btn @click="showModalSmall = true;" color="secondary">
56
+ Clique para abrir
57
+ </v-btn>
58
+ </div>`,
59
+ });
60
+
61
+ export const ModalScrollVertical = () => ({
62
+ components: {
63
+ DialogHeader,
64
+ DialogFooter,
65
+ },
66
+ data() {
67
+ return {
68
+ showModalSmall: false,
69
+ };
70
+ },
71
+ template: `<div>
72
+ <v-dialog content-class="modal-default modal-default-small" v-model="showModalSmall">
73
+ <DialogHeader title="Exemplo" @onClose="showModalSmall = false;" />
74
+ <v-main class="pa-6 pt-12">
75
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
76
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
77
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
78
+ </v-main>
79
+ <DialogFooter :hasConfirm="false" @onClose="showModalSmall = false;" />
80
+ </v-dialog>
81
+ <v-btn @click="showModalSmall = true;" color="secondary">
82
+ Clique para abrir
83
+ </v-btn>
84
+ </div>`,
85
+ });
86
+
87
+ export const ModalScrollHorizontal = () => ({
88
+ components: {
89
+ DialogHeader,
90
+ DialogFooter,
91
+ },
92
+ data() {
93
+ return {
94
+ open: false,
95
+ };
96
+ },
97
+ template: `<div>
98
+ <v-dialog content-class="modal-default modal-default-small" v-model="open">
99
+ <DialogHeader title="Exemplo" @onClose="open = false;" />
100
+ <v-main class="pa-6 pt-12" >
101
+ <table>
102
+ <tr>
103
+ <th>Company</th>
104
+ <th>Name</th>
105
+ <th>Country</th>
106
+ <th>Contact</th>
107
+ <th>Email</th>
108
+ </tr>
109
+ <tr>
110
+ <td>Alfreds Futterkiste</td>
111
+ <td>Maria Anders</td>
112
+ <td>Germany</td>
113
+ <td>+55193764-8418</td>
114
+ <td>najes39390@dufeed.com</td>
115
+ </tr>
116
+ <tr>
117
+ <td>Centro comercial Moctezuma</td>
118
+ <td>Francisco Chang</td>
119
+ <td>Mexico</td>
120
+ <td>+55193764-8418</td>
121
+ <td>najes39390@dufeed.com</td>
122
+ </tr>
123
+ <tr>
124
+ <td>Ernst Handel</td>
125
+ <td>Roland Mendel</td>
126
+ <td>Austria</td>
127
+ <td>+55193764-8418</td>
128
+ <td>najes39390@dufeed.com</td>
129
+ </tr>
130
+ <tr>
131
+ <td>Island Trading</td>
132
+ <td>Helen Bennett</td>
133
+ <td>UK</td>
134
+ <td>+55193764-8418</td>
135
+ <td>najes39390@dufeed.com</td>
136
+ </tr>
137
+ <tr>
138
+ <td>Laughing Bacchus Winecellars</td>
139
+ <td>Yoshi Tannamuri</td>
140
+ <td>Canada</td>
141
+ <td>+55193764-8418</td>
142
+ <td>najes39390@dufeed.com</td>
143
+ </tr>
144
+ <tr>
145
+ <td>Magazzini Alimentari Riuniti</td>
146
+ <td>Giovanni Rovelli</td>
147
+ <td>Italy</td>
148
+ <td>+55193764-8418</td>
149
+ <td>najes39390@dufeed.com</td>
150
+ </tr>
151
+ </table>
152
+ </v-main>
153
+ </v-dialog>
154
+ <v-btn @click="open = true;" color="secondary">
155
+ Clique para abrir
156
+ </v-btn>
157
+ </div>`,
158
+ });
159
+
38
160
  Modal.story = {
39
161
  name: 'Básico',
40
162
  parameters: {
@@ -45,3 +167,18 @@ Modal.story = {
45
167
  },
46
168
  },
47
169
  };
170
+
171
+ ModalSmall.story = {
172
+ name: 'Pequeno',
173
+ parameters: {
174
+ design: {
175
+ type: 'figma',
176
+ url:
177
+ 'https://www.figma.com/file/rkkAsX4IP0tzv1udIDXlqe/%E2%9C%8D---Onboarding---PJ?node-id=5336%3A32496',
178
+ },
179
+ },
180
+ };
181
+
182
+ ModalScrollVertical.storyName = 'Rolagem vertical'
183
+
184
+ ModalScrollHorizontal.storyName = 'Rolagem horizontal'
@@ -0,0 +1,27 @@
1
+ export default {
2
+ title: 'Examples/Inputs/Select',
3
+ parameters: {
4
+ docs: {
5
+ description: {
6
+ component: `How to show select (v-select)<br />
7
+ `,
8
+ },
9
+ },
10
+ },
11
+ };
12
+
13
+ export const VSelect = () => ({
14
+ data() {
15
+ return {
16
+ items: ['SP', 'RJ', 'MG', 'RS', 'BA'],
17
+ };
18
+ },
19
+ template: `
20
+ <v-col cols="12" sm="6" md="2" class="v-col-fieldset-default pl-0">
21
+ <v-select dense outlined :items="items" />
22
+ </v-col>`,
23
+ });
24
+
25
+ VSelect.story = {
26
+ name: 'Básico',
27
+ };
@@ -2,4 +2,16 @@
2
2
  .v-list--dense .v-list-item .v-list-item__title {
3
3
  font-weight: bold;
4
4
  }
5
+
6
+ [role='listbox'] {
7
+ padding: 0;
8
+
9
+ div.v-list-item {
10
+ border-bottom: 1px solid var(--v-gray-lighten2);
11
+
12
+ &:last-child {
13
+ border-bottom: 0;
14
+ }
15
+ }
16
+ }
5
17
  }