@farm-investimentos/front-mfe-components-vue3 0.6.1 → 0.7.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.
Files changed (34) hide show
  1. package/dist/front-mfe-components.common.js +224 -134
  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 +224 -134
  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 +1 -1
  9. package/src/components/ChipInviteStatus/keys.ts +9 -9
  10. package/src/components/ContextMenu/ContextMenu.stories.js +0 -4
  11. package/src/components/DatePicker/DatePicker.vue +3 -1
  12. package/src/components/InputDecimalFormatter/__tests__/InputMoney.spec.js +6 -3
  13. package/src/components/ListItem/ListItem.scss +54 -8
  14. package/src/components/ListItem/ListItem.vue +2 -2
  15. package/src/components/MainFilter/MainFilter.vue +1 -0
  16. package/src/components/Modal/Modal.vue +6 -10
  17. package/src/components/Modal/__tests__/Modal.spec.js +10 -0
  18. package/src/components/ModalPromptUser/ModalPromptUser.vue +1 -1
  19. package/src/components/ModalPromptUser/__tests__/ModalPromptUser.spec.js +1 -1
  20. package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +1 -1
  21. package/src/components/Select/Select.scss +5 -5
  22. package/src/components/Select/Select.stories.js +74 -0
  23. package/src/components/Select/Select.vue +166 -64
  24. package/src/components/Select/__tests__/Select.spec.js +62 -1
  25. package/src/components/Select/__tests__/selectItemHandler.spec.js +93 -0
  26. package/src/components/Select/composition/buildData.ts +2 -0
  27. package/src/components/Select/composition/index.ts +3 -1
  28. package/src/components/Select/composition/selectItemHandler.ts +60 -0
  29. package/src/components/Select/composition/watchAllChecked.ts +23 -0
  30. package/src/components/SelectAutoComplete/SelectAutoComplete.vue +1 -1
  31. package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +1 -1
  32. package/src/components/TextArea/__tests__/TextArea.spec.js +5 -1
  33. package/src/interfaces/ISelectItem.ts +5 -0
  34. package/src/scss/Sticky-table.scss +13 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components-vue3",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,11 +1,11 @@
1
1
  export default {
2
- 10: { label: 'Convidar', color: 'primary' },
3
- 11: { label: 'Convidado', color: 'warning', outlined: true },
4
- 12: { label: 'Incompleto', color: 'warning', outlined: true },
5
- 13: { label: 'Concluído', color: 'primary', outlined: true },
6
- 14: { label: 'Falha/Erro', color: 'error', outlined: true },
7
- 15: { label: 'Em Análise', color: 'info', outlined: true },
8
- 16: { label: 'Em Andamento', color: 'secondary', variation: 'darken' },
9
- 17: { label: 'Em Espera', color: 'secondary' },
10
- 18: { label: 'Declinado', color: 'error', outlined: true },
2
+ 10: { label: 'Convidar', color: 'success', variation: 'base' },
3
+ 11: { label: 'Convidado', color: 'warning', variation: 'lighten' },
4
+ 12: { label: 'Incompleto', color: 'error', variation: 'lighten' },
5
+ 13: { label: 'Concluído', color: 'success', variation: 'lighten' },
6
+ 14: { label: 'Falha/Erro', color: 'error', variation: 'base' },
7
+ 15: { label: 'Em Análise', color: 'info', variation: 'base' },
8
+ 16: { label: 'Em Andamento', color: 'secondary-golden', variation: 'darken' },
9
+ 17: { label: 'Em Espera', color: 'info', variation: 'lighten' },
10
+ 18: { label: 'Declinado', color: 'neutral', variation: 'base' },
11
11
  };
@@ -25,7 +25,6 @@ export const Primary = () => ({
25
25
  <template v-slot:activator="{ on, attrs }">
26
26
  <farm-btn
27
27
  v-bind="attrs"
28
- v-on="on"
29
28
  >
30
29
  open
31
30
  </farm-btn>
@@ -41,7 +40,6 @@ export const LongActivator = () => ({
41
40
  <template v-slot:activator="{ on, attrs }">
42
41
  <farm-btn
43
42
  v-bind="attrs"
44
- v-on="on"
45
43
  >
46
44
  Very long Activator
47
45
  </farm-btn>
@@ -57,7 +55,6 @@ export const IconActivator = () => ({
57
55
  <template v-slot:activator="{ on, attrs }">
58
56
  <farm-btn
59
57
  v-bind="attrs"
60
- v-on="on"
61
58
  icon
62
59
  >
63
60
  <farm-icon>help-circle</farm-icon>
@@ -209,7 +206,6 @@ export const Right = () => ({
209
206
  <template v-slot:activator="{ on, attrs }">
210
207
  <farm-btn
211
208
  v-bind="attrs"
212
- v-on="on"
213
209
  >
214
210
  open
215
211
  </farm-btn>
@@ -233,13 +233,15 @@ export default {
233
233
  this.dateField = this.modelValue;
234
234
  }
235
235
  },
236
+ pickerDate(newValue) {
237
+ this.internalPickerDate = newValue;
238
+ },
236
239
  },
237
240
  methods: {
238
241
  save() {
239
242
  this.inputVal = this.dateField;
240
243
  this.menuField = false;
241
244
  this.closeDatepicker();
242
-
243
245
  },
244
246
  clear() {
245
247
  this.dateField = this.multiple ? [] : '';
@@ -8,9 +8,12 @@ describe('InputDecimalFormatter component', () => {
8
8
 
9
9
  beforeEach(() => {
10
10
  wrapper = shallowMount(InputDecimalFormatter, {
11
- directives: {
12
- mask: () => { },
13
- },
11
+ global: {
12
+ directives: {
13
+ mask: () => { },
14
+ money3: () => { },
15
+ },
16
+ }
14
17
  });
15
18
  component = wrapper.vm;
16
19
  });
@@ -8,10 +8,24 @@
8
8
  display: flex;
9
9
  align-items: center;
10
10
 
11
+ .farm-icon,
12
+ .farm-typography {
13
+ color: var(--farm-neutral-darken);
14
+ }
15
+
11
16
  &--clickable {
12
17
  cursor: pointer;
13
18
  }
14
19
 
20
+ &--disabled {
21
+ cursor: default;
22
+
23
+ .farm-icon,
24
+ .farm-typography {
25
+ color: var(--farm-stroke-disabled);
26
+ }
27
+ }
28
+
15
29
  > a {
16
30
  text-decoration: none;
17
31
  }
@@ -20,17 +34,49 @@
20
34
  &:focus {
21
35
  border-radius: 5px;
22
36
 
23
- @each $color in $theme-colors-list {
24
- &#{'.farm-listitem--' + $color + '-base'} {
25
- background-color: rgba(themeColor($color), 0.27);
26
- }
37
+ &:not(.farm-listitem--disabled) {
38
+ @each $color in $theme-colors-list {
39
+ &#{'.farm-listitem--' + $color + '-base'} {
40
+ background-color: rgba(themeColor($color), 0.27);
41
+ .farm-icon,
42
+ .farm-typography {
43
+ color: rgba(themeColor($color), 1);
44
+ }
45
+ }
46
+
47
+ &#{'.farm-listitem--' + $color + '-lighten'} {
48
+ background-color: rgba(themeColor($color, 'lighten'), 0.27);
49
+ .farm-icon,
50
+ .farm-typography {
51
+ color: rgba(themeColor($color), 1);
52
+ }
53
+ }
27
54
 
28
- &#{'.farm-listitem--' + $color + '-lighten'} {
29
- background-color: rgba(themeColor($color, 'lighten'), 0.27);
55
+ &#{'.farm-listitem--' + $color + '-darken'} {
56
+ background-color: rgba(themeColor($color, 'darken'), 0.27);
57
+ .farm-icon,
58
+ .farm-typography {
59
+ color: rgba(themeColor($color), 1);
60
+ }
61
+ }
30
62
  }
63
+ }
64
+ }
65
+
66
+ &:active {
67
+ &:not(.farm-listitem--disabled) {
68
+ @each $color in $theme-colors-list {
69
+ &#{'.farm-listitem--' + $color + '-base'} {
70
+ background-color: rgba(themeColor($color), 0.8);
71
+ }
72
+
73
+ &#{'.farm-listitem--' + $color + '-lighten'} {
74
+ background-color: rgba(themeColor($color, 'lighten'), 0.8);
75
+ }
31
76
 
32
- &#{'.farm-listitem--' + $color + '-darken'} {
33
- background-color: rgba(themeColor($color, 'darken'), 0.27);
77
+ &#{'.farm-listitem--' + $color + '-darken'} {
78
+ background-color: rgba(themeColor($color, 'darken'), 0.8);
79
+ }
34
80
  }
35
81
  }
36
82
  }
@@ -60,8 +60,8 @@ export default {
60
60
  return `farm-listitem--${hoverColor.value}-${hoverColorVariation.value}`;
61
61
  });
62
62
 
63
- const onClick = () => {
64
- emit('click:item');
63
+ const onClick = (event) => {
64
+ emit('click:item', event);
65
65
  };
66
66
 
67
67
  return {
@@ -29,6 +29,7 @@
29
29
  <farm-btn
30
30
  v-if="hasExtraFilters"
31
31
  class="farm-btn__cta"
32
+ outlined
32
33
  :title="extraFiltersBtnLabel"
33
34
  @click="onFilterClick"
34
35
  >
@@ -21,21 +21,16 @@
21
21
  <slot name="footer"></slot>
22
22
  </div>
23
23
  </div>
24
- <div class="farm-modal--overlay" @click="close()"></div>
24
+ <div
25
+ class="farm-modal--overlay"
26
+ @click="close()"
27
+ ></div>
25
28
  </div>
26
29
  </transition>
27
30
  </template>
28
31
 
29
32
  <script lang="ts">
30
- import {
31
- onBeforeUnmount,
32
- onMounted,
33
- PropType,
34
- reactive,
35
- ref,
36
- toRefs,
37
- watch,
38
- } from 'vue';
33
+ import { onBeforeUnmount, onMounted, PropType, reactive, ref, toRefs, watch } from 'vue';
39
34
 
40
35
  import { calculateMainZindex } from '../../helpers';
41
36
 
@@ -87,6 +82,7 @@ export default {
87
82
  window.removeEventListener('keyup', escHandler);
88
83
  inputValue.value = false;
89
84
  emit('update:modelValue', false);
85
+ emit('onClose');
90
86
  };
91
87
 
92
88
  watch(
@@ -4,6 +4,7 @@ import Modal from '../index';
4
4
 
5
5
  describe('Modal component', () => {
6
6
  let wrapper;
7
+ let component;
7
8
 
8
9
  beforeEach(() => {
9
10
  wrapper = shallowMount(Modal, {
@@ -11,9 +12,18 @@ describe('Modal component', () => {
11
12
  modelValue: false,
12
13
  },
13
14
  });
15
+ component = wrapper.vm;
14
16
  });
15
17
 
16
18
  test('Modal created', () => {
17
19
  expect(wrapper).toBeDefined();
18
20
  });
21
+
22
+ describe('Methods', () => {
23
+ it('Should emit events when call close function', () => {
24
+ component.close();
25
+ expect(wrapper.emitted()['update:modelValue']).toBeDefined();
26
+ expect(wrapper.emitted()['onClose']).toBeDefined();
27
+ });
28
+ });
19
29
  });
@@ -115,7 +115,7 @@ export default {
115
115
  computed: {
116
116
  inputVal: {
117
117
  get() {
118
- return this.value;
118
+ return this.modelValue;
119
119
  },
120
120
  set(val) {
121
121
  this.$emit('update:modelValue', val);
@@ -7,7 +7,7 @@ describe('ModalPromptUser component', () => {
7
7
 
8
8
  beforeEach(() => {
9
9
  wrapper = shallowMount(ModalPromptUser, {
10
- propsData: {
10
+ props: {
11
11
  modelValue: false,
12
12
  title: '',
13
13
  subtitle: '',
@@ -8,7 +8,7 @@ describe('RadioGroup component', () => {
8
8
  beforeEach(() => {
9
9
  wrapper = shallowMount(RadioGroup, {
10
10
  propsData: {
11
- value: 1,
11
+ modelValue: 1,
12
12
  },
13
13
  });
14
14
  });
@@ -28,22 +28,22 @@
28
28
  margin-right: 8px;
29
29
  }
30
30
 
31
- :deep(.farm-listitem:hover .farm-typography) {
31
+ :deep(.farm-listitem:not(.farm-listitem--disabled):hover .farm-typography) {
32
32
  color: var(--farm-primary-base);
33
33
  }
34
34
 
35
- :deep(.farm-listitem:focus .farm-typography) {
35
+ :deep(.farm-listitem:not(.farm-listitem--disabled):focus .farm-typography) {
36
36
  color: var(--farm-primary-base);
37
37
  }
38
38
 
39
- :deep(.farm-listitem:hover .farm-checkbox .farm-icon) {
39
+ :deep(.farm-listitem:not(.farm-listitem--disabled):hover .farm-checkbox .farm-icon) {
40
40
  color: var(--farm-primary-lighten);
41
41
  }
42
42
 
43
- :deep(.farm-listitem:focus .farm-checkbox .farm-icon) {
43
+ :deep(.farm-listitem:not(.farm-listitem--disabled):focus .farm-checkbox .farm-icon) {
44
44
  color: var(--farm-primary-lighten);
45
45
  }
46
46
 
47
47
  :deep(.farm-listitem:hover .farm-checkbox.farm-checkbox--checked .farm-icon) {
48
48
  color: white;
49
- }
49
+ }
@@ -251,6 +251,42 @@ export const Multiple = () => ({
251
251
  </div>`,
252
252
  });
253
253
 
254
+ export const MultipleSelectAll = () => ({
255
+ data() {
256
+ return {
257
+ v: null,
258
+ items: [
259
+ { value: 0, text: 'value 0' },
260
+ { value: 1, text: 'value 1' },
261
+ { value: 2, text: 'value 2' },
262
+ { value: 3, text: 'value 3' },
263
+ ],
264
+ };
265
+ },
266
+ template: `<div style="width: 400px">
267
+ <farm-select v-model="v" :items="items" multiple has-all-option />
268
+ v-model: {{ v }}
269
+ </div>`,
270
+ });
271
+
272
+ export const MultipleWithAllOptionAndDisabledItems = () => ({
273
+ data() {
274
+ return {
275
+ v: null,
276
+ items: [
277
+ { value: 0, text: 'value 0' },
278
+ { value: 1, text: 'value 1', disabled: true },
279
+ { value: 2, text: 'value 2' },
280
+ { value: 3, text: 'value 3', disabled: true },
281
+ ],
282
+ };
283
+ },
284
+ template: `<div style="width: 400px">
285
+ <farm-select v-model="v" :items="items" multiple has-all-option />
286
+ v-model: {{ v }}
287
+ </div>`,
288
+ });
289
+
254
290
  export const MultipleInitValue = () => ({
255
291
  data() {
256
292
  return {
@@ -344,3 +380,41 @@ export const ChangeEvent = () => ({
344
380
 
345
381
  </div>`,
346
382
  });
383
+
384
+ export const DisabledKeys = () => ({
385
+ data() {
386
+ return {
387
+ v: null,
388
+ items: [
389
+ { value: 1, text: ' value 1', disabled: true },
390
+ { value: 2, text: ' value 2', disabled: true },
391
+ { value: 3, text: ' value 3' },
392
+ ],
393
+ };
394
+ },
395
+ methods: {
396
+ allowAllOptions() {
397
+ this.items = [
398
+ { value: 1, text: ' value 1' },
399
+ { value: 2, text: ' value 2' },
400
+ { value: 3, text: ' value 3' },
401
+ ];
402
+ },
403
+ reset() {
404
+ this.items = [
405
+ { value: 1, text: ' value 1', disabled: true },
406
+ { value: 2, text: ' value 2', disabled: true },
407
+ { value: 3, text: ' value 3' },
408
+ ];
409
+ this.v = null;
410
+ },
411
+ },
412
+ template: `<farm-row>
413
+ <farm-col md="4">
414
+ <farm-select v-model="v" :items="items" />
415
+ v-model: {{ v }}
416
+ <farm-btn @click="allowAllOptions">Habilitar todos itens</farm-btn>
417
+ <farm-btn @click="reset">Resetar</farm-btn>
418
+ </farm-col>
419
+ </farm-row>`,
420
+ });