@farm-investimentos/front-mfe-components-vue3 0.4.0 → 0.5.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.
@@ -40,10 +40,10 @@ export const Primary = () => ({
40
40
  };
41
41
  },
42
42
  template: `<div style="width: 480px;">
43
- <farm-label for="select_label">
43
+ <farm-label for="input-primary">
44
44
  label
45
45
  </farm-label>
46
- <farm-textfield-v2 id="select_label" v-model="v" />
46
+ <farm-textfield-v2 id="input-primary" v-model="v" />
47
47
  v-model: {{ v }}
48
48
  </div>`,
49
49
  });
@@ -219,11 +219,11 @@ export const Mask = () => ({
219
219
  },
220
220
  template: `<div style="width: 480px">
221
221
  <farm-label>CPF Mask ({{ mask }})</farm-label>
222
- <farm-textfield-v2 v-model="v" :mask="mask" />
222
+ <farm-textfield-v2 id="input-mask-cpf" v-model="v" :mask="mask" />
223
223
  v-model: {{ v }}
224
224
 
225
225
  <farm-label>Number Mask (R$ ##.###.###,##)</farm-label>
226
- <farm-textfield-v2 v-model="v2" :mask="currencyMask" />
226
+ <farm-textfield-v2 id="input-mask-number" v-model="v2" :mask="currencyMask" />
227
227
  v-model: {{ v2 }}
228
228
 
229
229
  </div>`,
@@ -242,7 +242,7 @@ export const ToggleVisibility = () => ({
242
242
  },
243
243
  },
244
244
  template: `<div style="width: 480px">
245
- <farm-textfield-v2 v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
245
+ <farm-textfield-v2 id="input-visibility" v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
246
246
  </div>`,
247
247
  });
248
248
 
@@ -253,9 +253,10 @@ export const Uppercase = () => ({
253
253
  };
254
254
  },
255
255
  template: `<div style="width: 480px;">
256
- <farm-label for="select_label">
256
+ <farm-label for="input-uppercase">
257
257
  label
258
258
  </farm-label>
259
- <farm-textfield-v2 id="select_label" v-model="v" uppercase/>
259
+ <farm-textfield-v2 id="input-uppercase" v-model="v" uppercase/>
260
260
  </div>`,
261
261
  });
262
+
@@ -25,10 +25,14 @@
25
25
  v-if="icon && iconPosition === 'left'"
26
26
  @click="$emit('onClickIcon')"
27
27
  >
28
- <farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
28
+ <farm-icon
29
+ color="gray"
30
+ size="20px"
31
+ >{{ icon }}</farm-icon
32
+ >
29
33
  </button>
30
34
  <input
31
- v-bind="delete {...$attrs}.class"
35
+ v-bind="delete { ...$attrs }.class"
32
36
  v-model="innerValue"
33
37
  v-mask="mask"
34
38
  :id="$props.id"
@@ -46,10 +50,18 @@
46
50
  v-if="icon && iconPosition === 'right'"
47
51
  @click="$emit('onClickIcon')"
48
52
  >
49
- <farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
53
+ <farm-icon
54
+ color="gray"
55
+ size="20px"
56
+ >{{ icon }}</farm-icon
57
+ >
50
58
  </button>
51
59
  </div>
52
- <farm-caption v-if="!hideDetails && showErrorText" color="error" variation="regular">
60
+ <farm-caption
61
+ v-if="!hideDetails && showErrorText"
62
+ color="error"
63
+ variation="regular"
64
+ >
53
65
  {{ errorBucket[0] }}
54
66
  </farm-caption>
55
67
  <farm-caption
@@ -67,7 +79,7 @@
67
79
  </template>
68
80
 
69
81
  <script lang="ts">
70
- import { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
82
+ import { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
71
83
 
72
84
  import deepEqual from '../../composition/deepEqual';
73
85
  import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
@@ -178,7 +190,6 @@ export default {
178
190
  const isBlured = ref(false);
179
191
  const isFocus = ref(false);
180
192
  const isUppercase = ref(props.uppercase);
181
-
182
193
  const { errorBucket, valid, validatable } = validateFormStateBuilder();
183
194
 
184
195
  let fieldValidator = validateFormFieldBuilder(rules.value);
@@ -4,6 +4,10 @@
4
4
  .farm-tooltip {
5
5
  display: inline-block;
6
6
  position: relative;
7
+
8
+ &__activator {
9
+ display: inline-block;
10
+ }
7
11
  }
8
12
 
9
13
  .farm-tooltip__popup {
@@ -13,7 +17,6 @@
13
17
  background-color: rgba(themeColor($color), 0.95);
14
18
  }
15
19
  }
16
-
17
20
  }
18
21
 
19
22
  .farm-tooltip__popup {
@@ -35,4 +38,4 @@
35
38
  opacity: 1;
36
39
  visibility: visible;
37
40
  }
38
- }
41
+ }
@@ -1,7 +1,15 @@
1
1
  <template>
2
- <span :class="{ 'farm-tooltip': true }" ref="parent">
3
- <span @mouseover="onOver" @mouseout="onOut" ref="activator">
4
- <slot name="activator"></slot>
2
+ <span
3
+ :class="{ 'farm-tooltip': true }"
4
+ ref="parent"
5
+ >
6
+ <span
7
+ class="farm-tooltip__activator"
8
+ ref="activator"
9
+ @mouseover="onOver"
10
+ @mouseout="onOut"
11
+ >
12
+ <slot name="activator" />
5
13
  </span>
6
14
 
7
15
  <span
@@ -15,7 +23,7 @@
15
23
  :style="styles"
16
24
  @mouseout="onOut"
17
25
  >
18
- <slot></slot>
26
+ <slot />
19
27
  </span>
20
28
  </span>
21
29
  </template>
@@ -1,20 +1,20 @@
1
1
  // import { withDesign } from 'storybook-addon-designs';
2
- import { VDataTable } from 'vuetify/labs/components';
2
+ import { VDataTable } from 'vuetify/components/VDataTable';
3
3
 
4
4
  const headers = [
5
5
  {
6
6
  title: 'ID',
7
7
  sortable: false,
8
- value: 'id',
8
+ key: 'id',
9
9
  width: 80,
10
- align: 'left',
10
+ align: 'center',
11
11
  },
12
12
  {
13
13
  title: 'Name',
14
14
  sortable: false,
15
- value: 'name',
15
+ key: 'name',
16
16
  width: 160,
17
- align: 'left',
17
+ align: 'end',
18
18
  },
19
19
  ];
20
20
 
@@ -57,7 +57,7 @@ export const TableNoData = () => ({
57
57
  });
58
58
 
59
59
  export const TableSampleData = () => ({
60
- components: { 'v-data-table': VDataTable },
60
+ components: { 'v-data-table': VDataTable },
61
61
  data() {
62
62
  return {
63
63
  headers,
@@ -173,6 +173,7 @@ export const TableSampleDataWithFarmCheckbox = () => ({
173
173
  },
174
174
  methods: {
175
175
  onSelect({ item }) {
176
+ console.log(item);
176
177
  if (item.id === 2)
177
178
  this.selectedItems = [...this.selectedItems].filter(
178
179
  innerItem => innerItem.id !== 2
@@ -181,20 +182,31 @@ export const TableSampleDataWithFarmCheckbox = () => ({
181
182
  isItemSelected(item) {
182
183
  return this.selectedItems.some(innerItem => innerItem.id === item.id);
183
184
  },
185
+ select(item) {
186
+ if (this.selectedItems.some(innerItem => innerItem.id === item.id)) {
187
+ this.selectedItems = this.selectedItems.filter(
188
+ innerItem => innerItem.id !== item.id
189
+ );
190
+ return;
191
+ }
192
+ this.selectedItems.push(item);
193
+ },
184
194
  },
185
195
  template: `<div>{{selectedItems}}
186
196
  <v-data-table
187
- hide-default-footer
197
+ show-select
188
198
  id="v-data-table--default"
189
199
  v-model="selectedItems"
190
- show-select
200
+
191
201
  :headers="headers"
192
202
  :items="items"
193
203
  @item-selected="onSelect"
194
204
  >
195
- <template v-slot:item.data-table-select="{ isSelected, select, item }">
196
- <farm-checkbox :value="item.id" :checked="isItemSelected(item)" @input="select($event)"/>
205
+ <template v-slot:item.data-table-select="{ isSelected, item }">
206
+ <farm-checkbox :value="item.id" :checked="isItemSelected(item)" @click="select(item)"/>
207
+ </template>
208
+ <template v-slot:bottom>
197
209
  </template>
198
210
  </v-data-table>
199
211
  </div>`,
200
- });
212
+ });
package/src/main.ts CHANGED
@@ -78,6 +78,7 @@ export * from './components/Switcher';
78
78
  export * from './components/Tabs';
79
79
  export * from './components/TextArea';
80
80
  export * from './components/TextFieldV2';
81
+ export * from './components/InputMoney';
81
82
  export * from './components/Tooltip';
82
83
  export * from './components/Typography';
83
84
  export * from './components/ValueCaption';