@farm-investimentos/front-mfe-components 14.1.5 → 14.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "14.1.5",
3
+ "version": "14.2.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -2,11 +2,11 @@
2
2
  @import '../../../configurations/mixins';
3
3
  @import '../../../configurations/theme-colors';
4
4
  $butonSizes: (
5
- "xs": 20px,
6
- "sm": 28px,
7
- "md": 32px,
8
- "lg": 48px,
9
- "xl": 56px,
5
+ 'xs': 20px,
6
+ 'sm': 28px,
7
+ 'md': 32px,
8
+ 'lg': 48px,
9
+ 'xl': 56px,
10
10
  'default': 36px,
11
11
  );
12
12
 
@@ -37,8 +37,7 @@ $butonSizes: (
37
37
  width: 100%;
38
38
  }
39
39
 
40
- @each $size,
41
- $value in $sizes {
40
+ @each $size, $value in $sizes {
42
41
  &#{'.farm-btn[size=' + $size + ']'} {
43
42
  font-size: $value;
44
43
  height: map-get($butonSizes, $size);
@@ -136,8 +135,7 @@ $butonSizes: (
136
135
  color: gray;
137
136
  }
138
137
 
139
- @each $size,
140
- $value in $sizes {
138
+ @each $size, $value in $sizes {
141
139
  &#{'.farm-btn[size=' + $size + ']'} {
142
140
  font-size: $value;
143
141
  }
@@ -162,11 +160,30 @@ $butonSizes: (
162
160
  ::v-deep .farm-btn__content i.mdi {
163
161
  color: var(--farm-#{$color}-base);
164
162
  }
163
+
164
+ &.lighten-variation-icon {
165
+ &:hover {
166
+ color: var(--farm-#{$color}-lighten);
167
+ }
168
+
169
+ ::v-deep .farm-btn__content i.mdi {
170
+ color: var(--farm-#{$color}-lighten);
171
+ }
172
+ }
173
+
174
+ &.darken-variation-icon {
175
+ &:hover {
176
+ color: var(--farm-#{$color}-darken);
177
+ }
178
+
179
+ ::v-deep .farm-btn__content i.mdi {
180
+ color: var(--farm-#{$color}-darken);
181
+ }
182
+ }
165
183
  }
166
184
  }
167
185
 
168
186
  &#{'.farm-btn--white'}:not(.farm-btn--disabled) {
169
-
170
187
  ::v-deep .farm-btn__content i.mdi {
171
188
  color: white;
172
189
  }
@@ -190,7 +207,6 @@ $butonSizes: (
190
207
  }
191
208
  }
192
209
  }
193
-
194
210
  }
195
211
 
196
212
  .farm-btn--extra,
@@ -270,4 +286,4 @@ $butonSizes: (
270
286
  width: 100%;
271
287
  margin: 0;
272
288
  }
273
- }
289
+ }
@@ -201,6 +201,16 @@ export const Iconed = () => ({
201
201
  <farm-icon>book</farm-icon>
202
202
  </farm-btn>
203
203
 
204
+ <h4>Darken Icon</h4>
205
+ <farm-btn icon v-for="color of colors" :key="'random_2_' + color" :color="color" variation="darken">
206
+ <farm-icon>book</farm-icon>
207
+ </farm-btn>
208
+
209
+ <h4>Lighten Icon</h4>
210
+ <farm-btn icon v-for="color of colors" :key="'random_2_' + color" :color="color" variation="lighten">
211
+ <farm-icon>book</farm-icon>
212
+ </farm-btn>
213
+
204
214
  <h4>Disabled Icon</h4>
205
215
  <farm-btn icon v-for="color of colors" :key="'disabled_random_2_' + color" :color="color" :disabled="true">
206
216
  <farm-icon>book</farm-icon>
@@ -87,6 +87,13 @@ export default Vue.extend({
87
87
  type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
88
88
  default: 'default',
89
89
  },
90
+ /**
91
+ * Color Variation to Icons
92
+ */
93
+ variation: {
94
+ type: String as PropType<'base' | 'lighten' | 'darken'>,
95
+ default: 'base',
96
+ },
90
97
  },
91
98
 
92
99
  computed: {
@@ -105,6 +112,7 @@ export default Vue.extend({
105
112
  'farm-btn--icon': this.icon,
106
113
  'farm-btn--full': this.full,
107
114
  ['farm-btn--' + this.color]: true,
115
+ [this.variation + '-variation-icon']: true,
108
116
  ...obj,
109
117
  };
110
118
  },
@@ -10,6 +10,7 @@
10
10
  }
11
11
 
12
12
  .farm-icon {
13
+ transition: transform .8s ease-in-out;
13
14
  &.farm-icon--asc {
14
15
  transform: rotateX(180deg);
15
16
  }
@@ -19,13 +20,19 @@
19
20
  th.sortable {
20
21
  cursor: pointer;
21
22
 
23
+
22
24
  &:not(.active) {
23
25
  &:hover {
24
- .farm-icon {
25
- opacity: 0.5 !important;
26
+ .farm-icon::before {
27
+ color: var(--farm-gray-base) !important;
26
28
  }
27
29
  }
28
30
  }
31
+
32
+ .header-text {
33
+ transition: color 0.5s ease;
34
+ }
35
+
29
36
  }
30
37
 
31
38
  th span.span-checkbox {
@@ -47,7 +54,7 @@ th {
47
54
  }
48
55
 
49
56
  :deep(.mdi-sort-descending)::before {
50
- color: var(--farm-gray-base);
57
+ color: var(--farm-secondary-base);
51
58
  font-size: 12px;
52
59
  font-weight: 900;
53
60
  }
@@ -55,4 +62,4 @@ th {
55
62
  .farm-icon--desc,
56
63
  .farm-icon--asc {
57
64
  margin-top: 3.5px;
58
- }
65
+ }
@@ -23,10 +23,37 @@ export const Primary = () => ({
23
23
  return {
24
24
  headers,
25
25
  sortClick: [],
26
- firstSelected: false,
26
+ firstSelected: true,
27
+
27
28
  };
28
29
  },
29
- template: `<farm-datatable-header :headers="headers" :sortClick="sortClick" :showCheckbox="false" :firstSelected="firstSelected" />`,
30
+ template: `<farm-datatable-header
31
+ :headers="headers"
32
+ :sortClick="sortClick"
33
+ :showCheckbox="false"
34
+ :firstSelected="firstSelected"
35
+ :selectedIndex="1"
36
+ />`,
37
+ });
38
+
39
+ export const SetDescInititalOrder = () => ({
40
+ data() {
41
+ let customHeaders = [...headers];
42
+ customHeaders[1].order = 'DESC';
43
+ return {
44
+ headers: customHeaders,
45
+ sortClick: [],
46
+ firstSelected: true,
47
+
48
+ };
49
+ },
50
+ template: `<farm-datatable-header
51
+ :headers="headers"
52
+ :sortClick="sortClick"
53
+ :showCheckbox="false"
54
+ :firstSelected="firstSelected"
55
+ :selectedIndex="1"
56
+ />`,
30
57
  });
31
58
 
32
59
  export const CheckBox = () => ({
@@ -46,7 +73,13 @@ export const CheckBox = () => ({
46
73
  firstSelected: false,
47
74
  };
48
75
  },
49
- template: `<farm-datatable-header :headers="headers" :headerProps="headerProps" :sortClick="sortClick" :firstSelected="firstSelected" :showCheckbox="true" :selectedIndex="1" />`,
76
+ template: `<farm-datatable-header
77
+ :headers="headers"
78
+ :headerProps="headerProps"
79
+ :sortClick="sortClick"
80
+ :firstSelected="firstSelected"
81
+ :showCheckbox="true"
82
+ :selectedIndex="1" />`,
50
83
  });
51
84
 
52
85
  const headerProps = { someItems: true, everyItem: true };
@@ -57,13 +90,14 @@ const headers = [
57
90
  sortable: true,
58
91
  value: 'name',
59
92
  align: 'left',
93
+ width: 120,
60
94
  },
61
95
  {
62
96
  text: 'Aprovado',
63
97
  sortable: true,
64
98
  value: 'approvedAmount',
65
99
  align: 'center',
66
- width: 320,
100
+ width: 160,
67
101
  },
68
102
  {
69
103
  text: 'Disponível',
@@ -118,10 +118,13 @@ export default Vue.extend({
118
118
  return value ? 'DESC' : 'ASC';
119
119
  },
120
120
  clickSort(value, index) {
121
+ const isClicked = this.sortClick[index].clicked;
121
122
  this.removeClicked();
122
123
  this.sortClick[index].clicked = true;
123
124
  this.sortClick[index].show = true;
124
- this.sortClick[index][value] = !this.sortClick[index][value];
125
+ if (isClicked) {
126
+ this.sortClick[index][value] = !this.sortClick[index][value];
127
+ }
125
128
  this.sortClick[index].descending = this.getTypeSort(this.sortClick[index][value]);
126
129
  this.$emit('onClickSort', this.sortClick[index]);
127
130
  },
@@ -167,8 +170,11 @@ export default Vue.extend({
167
170
  created() {
168
171
  for (let i = 0; i < this.headers.length; i += 1) {
169
172
  this.sortClick.push({
170
- [this.headers[i].value]: false,
171
- descending: 'ASC',
173
+ [this.headers[i].value]:
174
+ this.firstSelected &&
175
+ i === this.selectedIndex &&
176
+ this.headers[i].order === 'DESC',
177
+ descending: this.headers[i].order || 'ASC',
172
178
  field: this.headers[i].value,
173
179
  clicked: this.checkFirstSelected(i),
174
180
  show: this.checkFirstSelected(i),
@@ -14,11 +14,11 @@ $radius: 5px;
14
14
 
15
15
  @each $color in $colors {
16
16
  &#{'.farm-progressbar--' + $color} {
17
- background-color: var(--v-#{$color}-base);
17
+ background-color: var(--farm-#{$color}-base);
18
18
  }
19
19
 
20
20
  &#{'.farm-progressbar--value-' + $color}>div {
21
- background-color: var(--v-#{$color}-base);
21
+ background-color: var(--farm-#{$color}-base);
22
22
  }
23
23
  }
24
24
 
@@ -14,7 +14,8 @@ export default {
14
14
  docs: {
15
15
  description: {
16
16
  component: `ProgressBar<br />
17
- selector: <em>farm-progressbar</em>`,
17
+ selector: <em>farm-progressbar</em><br />
18
+ <span style="color: var(--farm-primary-base);">ready for use</span>`,
18
19
  },
19
20
  },
20
21
  },
@@ -35,7 +36,7 @@ export const CustomColors = () => ({
35
36
  val: 35,
36
37
  };
37
38
  },
38
- template: '<farm-progressbar :value="val" backgroundColor="accent" valueColor="secondary" />',
39
+ template: '<farm-progressbar :value="val" background-color="info" value-color="secondary" />',
39
40
  });
40
41
 
41
42
  export const CustomHexaColors = () => ({
@@ -44,5 +45,5 @@ export const CustomHexaColors = () => ({
44
45
  val: 35,
45
46
  };
46
47
  },
47
- template: '<farm-progressbar :value="val" backgroundColor="#FFFF00" valueColor="#00FF00" />',
48
+ template: '<farm-progressbar :value="val" background-color="#FFFF00" value-color="#00FF00" />',
48
49
  });
@@ -4,7 +4,7 @@
4
4
  </div>
5
5
  </template>
6
6
  <script lang="ts">
7
- import Vue from 'vue';
7
+ import Vue, { PropType } from 'vue';
8
8
 
9
9
  export default Vue.extend({
10
10
  name: 'farm-progressbar',
@@ -12,11 +12,39 @@ export default Vue.extend({
12
12
  /**
13
13
  * backgroundColor
14
14
  */
15
- backgroundColor: { type: String, default: 'secondary' },
15
+ backgroundColor: {
16
+ type: String as PropType<
17
+ | 'primary'
18
+ | 'secondary'
19
+ | 'neutral'
20
+ | 'info'
21
+ | 'success'
22
+ | 'error'
23
+ | 'warning'
24
+ | 'extra-1'
25
+ | 'extra-2'
26
+ | any
27
+ >,
28
+ default: 'primary',
29
+ },
16
30
  /**
17
31
  * color
18
32
  */
19
- valueColor: { type: String, default: 'error' },
33
+ valueColor: {
34
+ type: String as PropType<
35
+ | 'primary'
36
+ | 'secondary'
37
+ | 'neutral'
38
+ | 'info'
39
+ | 'success'
40
+ | 'error'
41
+ | 'warning'
42
+ | 'extra-1'
43
+ | 'extra-2'
44
+ | any
45
+ >,
46
+ default: 'error',
47
+ },
20
48
  /**
21
49
  * Value (form 0 to 100)
22
50
  */
@@ -3,11 +3,13 @@ import ProgressBar from '../ProgressBar';
3
3
 
4
4
  describe('ProgressBar component', () => {
5
5
  let wrapper;
6
+ let component;
6
7
 
7
8
  beforeEach(() => {
8
9
  wrapper = shallowMount(ProgressBar, {
9
10
  propsData: { value: 40 },
10
11
  });
12
+ component = wrapper.vm;
11
13
  });
12
14
 
13
15
  test('Created hook', () => {
@@ -19,4 +21,11 @@ describe('ProgressBar component', () => {
19
21
  expect(wrapper.element).toMatchSnapshot();
20
22
  });
21
23
  });
24
+
25
+ describe('computed properties', () => {
26
+ it('classes', () => {
27
+ expect(component.classes).toBeDefined();
28
+ expect(component.classes).toHaveProperty('farm-progressbar');
29
+ });
30
+ });
22
31
  });
@@ -28,7 +28,7 @@
28
28
  margin: 24px 0;
29
29
  font-size: 12px;
30
30
  line-height: 20px;
31
- word-break: break-all;
31
+ word-break: break-word;
32
32
 
33
33
  ul {
34
34
  margin-left: 16px;