@farm-investimentos/front-mfe-components 15.0.4 → 15.0.6

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 (28) hide show
  1. package/dist/front-mfe-components.common.js +240 -226
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +2 -2
  4. package/dist/front-mfe-components.umd.js +240 -226
  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/Card/CardContent/CardContent.scss +0 -4
  10. package/src/components/ContextMenu/ContextMenu.stories.js +23 -0
  11. package/src/components/ContextMenu/ContextMenu.vue +2 -4
  12. package/src/components/CopyToClipboard/CopyToClipboard.stories.js +12 -0
  13. package/src/components/CopyToClipboard/CopyToClipboard.vue +29 -3
  14. package/src/components/DataTableHeader/DataTableHeader.scss +5 -5
  15. package/src/components/DataTableHeader/DataTableHeader.vue +7 -1
  16. package/src/components/Form/Form.stories.js +5 -4
  17. package/src/components/IdCaption/IdCaption.stories.js +2 -1
  18. package/src/components/IdCaption/IdCaption.vue +25 -3
  19. package/src/components/Logger/Logger.scss +8 -32
  20. package/src/components/Logger/Logger.stories.js +12 -0
  21. package/src/components/Logger/LoggerItem/LoggerItem.scss +1 -1
  22. package/src/components/Logger/LoggerItem/LoggerItem.stories.js +3 -3
  23. package/src/components/Logger/LoggerItem/LoggerItem.vue +2 -8
  24. package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +1 -1
  25. package/src/components/RangeDatePicker/RangeDatePicker.stories.js +20 -0
  26. package/src/components/RangeDatePicker/RangeDatePicker.vue +1 -2
  27. package/src/configurations/_variables.scss +4 -4
  28. package/src/scss/Sticky-table.scss +20 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "15.0.4",
3
+ "version": "15.0.6",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -8,13 +8,9 @@
8
8
  padding: map-get($gutters, $k);
9
9
  }
10
10
  }
11
-
12
-
13
11
  }
14
12
 
15
13
  @each $k in map-keys($background-colors) {
16
- @debug $k;
17
-
18
14
  #{'.farm-card__content--' + $k} {
19
15
  background-color: map-get($background-colors, $k);
20
16
  }
@@ -195,6 +195,29 @@ export const MaxHeight = () => ({
195
195
  </div>`,
196
196
  });
197
197
 
198
+ export const Right = () => ({
199
+ template: `<div style="width: 100%; display: flex; justify-content: right;">
200
+ <farm-contextmenu>
201
+ <farm-list>
202
+ <farm-listitem clickable hoverColor="primary">primary</farm-listitem>
203
+ <farm-listitem clickable hoverColor="extra-1" hoverColorVariation="lighten">extra 1 lighten</farm-listitem>
204
+ <farm-listitem clickable hoverColor="error" hoverColorVariation="lighten">
205
+ <farm-icon size="sm" color="error">trash-can</farm-icon>
206
+ <farm-typography color="error" tag="span">Error</farm-typography>
207
+ </farm-listitem>
208
+ </farm-list>
209
+ <template v-slot:activator="{ on, attrs }">
210
+ <farm-btn
211
+ v-bind="attrs"
212
+ v-on="on"
213
+ >
214
+ open
215
+ </farm-btn>
216
+ </template>
217
+ </farm-contextmenu>
218
+ </div>`,
219
+ });
220
+
198
221
  export const VModel = () => ({
199
222
  data() {
200
223
  return {
@@ -117,9 +117,8 @@ export default Vue.extend({
117
117
  window.addEventListener('resize', resizeWindowHandler);
118
118
  calculatePosition();
119
119
  } else {
120
- styles.display = 'none';
121
- styles.top = 0;
122
- styles.left = 0;
120
+ styles.top = '-10000px';
121
+ styles.left = '-10000px';
123
122
  styles.zIndex = 0;
124
123
  window.removeEventListener('click', outClick);
125
124
  }
@@ -161,7 +160,6 @@ export default Vue.extend({
161
160
  }
162
161
 
163
162
  //Do not allow to open outside window
164
-
165
163
  const rightEdge = offsetLeft + popupClientRect.width;
166
164
  const clientWidth = document.documentElement.clientWidth;
167
165
 
@@ -42,12 +42,24 @@ export const CustomSuccessMessage = () => ({
42
42
  </div>`,
43
43
  });
44
44
 
45
+ export const CustomButtonColor = () => ({
46
+ template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
47
+ <farm-copytoclipboard toCopy="To be copied" button-color="error" />
48
+ </div>`,
49
+ });
50
+
45
51
  export const CustomTooltipColor = () => ({
46
52
  template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
47
53
  <farm-copytoclipboard toCopy="To be copied" tooltip-color="info" />
48
54
  </div>`,
49
55
  });
50
56
 
57
+ export const CustomButtonAndTooltipColor = () => ({
58
+ template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
59
+ <farm-copytoclipboard toCopy="To be copied" button-color="error" tooltip-color="extra-1" />
60
+ </div>`,
61
+ });
62
+
51
63
  export const Modal = () => ({
52
64
  data() {
53
65
  return {
@@ -1,8 +1,15 @@
1
1
  <template>
2
- <farm-tooltip v-model="show" :color="tooltipColor">
2
+ <farm-tooltip v-model="show" :color="tooltipColor || buttonColor">
3
3
  {{ feedbackMessage }}
4
4
  <template v-slot:activator="{}">
5
- <farm-btn v-if="isIcon" title="Copiar" icon :disabled="disabled" @click="onClick">
5
+ <farm-btn
6
+ v-if="isIcon"
7
+ title="Copiar"
8
+ icon
9
+ :disabled="disabled"
10
+ :color="buttonColor"
11
+ @click="onClick"
12
+ >
6
13
  <farm-icon :size="sizeIcon">content-copy</farm-icon>
7
14
  </farm-btn>
8
15
  <farm-btn v-else outlined title="Copiar" :disabled="disabled" @click="onClick">
@@ -44,6 +51,25 @@ export default Vue.extend({
44
51
  type: String,
45
52
  default: 'Conteúdo copiado para a área de trabalho',
46
53
  },
54
+ /**
55
+ * Button color
56
+ */
57
+ buttonColor: {
58
+ type: String as PropType<
59
+ | 'primary'
60
+ | 'secondary'
61
+ | 'secondary-green'
62
+ | 'secondary-golden'
63
+ | 'neutral'
64
+ | 'info'
65
+ | 'success'
66
+ | 'error'
67
+ | 'warning'
68
+ | 'extra-1'
69
+ | 'extra-2'
70
+ >,
71
+ default: 'primary',
72
+ },
47
73
  /**
48
74
  * Tooltip color
49
75
  */
@@ -61,7 +87,7 @@ export default Vue.extend({
61
87
  | 'extra-1'
62
88
  | 'extra-2'
63
89
  >,
64
- default: 'primary',
90
+ default: null,
65
91
  },
66
92
  /**
67
93
  * Success message timeout (in ms)
@@ -18,17 +18,17 @@
18
18
 
19
19
  th.sortable {
20
20
  cursor: pointer;
21
+ .farm-icon::before {
22
+ transition: all 0.3s linear;
23
+ }
24
+
21
25
  &:not(.active) {
22
26
  &:hover {
23
27
  .farm-icon::before {
24
- color: var(--farm-bw-black-30) !important;
28
+ color: var(--farm-bw-black-10) !important;
25
29
  }
26
30
  }
27
31
  }
28
-
29
- .header-text {
30
- transition: color 0.5s ease;
31
- }
32
32
  }
33
33
 
34
34
  th span.span-checkbox {
@@ -19,7 +19,13 @@
19
19
  @mouseover="changeShow($index)"
20
20
  @mouseout="changeHidden($index)"
21
21
  >
22
- <span class="header-text" v-if="!isTHDataTableSelect(item)">
22
+ <span
23
+ class="header-text"
24
+ v-if="!isTHDataTableSelect(item)"
25
+ :title="
26
+ item.sortable && sortClick[$index].show ? `Ordernar por ${item.text}` : null
27
+ "
28
+ >
23
29
  {{ item.text }}
24
30
 
25
31
  <farm-icon
@@ -31,11 +31,12 @@ export const Primary = () => ({
31
31
  return {
32
32
  form: {
33
33
  document: 'Document',
34
- name: 'Name',
34
+ name: '',
35
35
  checkbox: '2',
36
36
  birthDate: new Date('1980/09/20').toISOString(),
37
37
  selectId: 1,
38
38
  rangeDate: [],
39
+ cityName: null,
39
40
  },
40
41
  validForm: false,
41
42
  rules: {
@@ -51,14 +52,14 @@ export const Primary = () => ({
51
52
  };
52
53
  },
53
54
  template: `
54
- <farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
55
+ <farm-form v-model="validForm" :style="[styles.vForm]" ref="form" autocomplete="off">
55
56
  <div>
56
57
  <farm-label :required="true">Documento</farm-label>
57
58
  <farm-textfield-v2 v-model="form.document" :rules="[rules.required]" />
58
59
  </div>
59
60
  <farm-label :required="true">Nome</farm-label>
60
- <farm-textfield-v2 v-model="form.name" :rules="[rules.required]" />
61
-
61
+ <farm-textfield-v2 v-model="form.name" :rules="[rules.required]" hint="Seu nome igual ao do RG" />
62
+
62
63
  <farm-label :required="true">True/false</farm-label>
63
64
  <farm-checkbox v-model="form.checkbox" value="1" :rules="[rules.checked]" />
64
65
 
@@ -173,11 +173,12 @@ export const CustomSuccessMessageAfterCopyToClipboard = () => ({
173
173
  `,
174
174
  });
175
175
 
176
- export const CustomTooltipColor = () => ({
176
+ export const CustomColors = () => ({
177
177
  template: `
178
178
  <farm-idcaption
179
179
  icon="account-box-outline"
180
180
  copy-text="Custom Success Message to be copied"
181
+ buttons-color="extra-1"
181
182
  tooltip-color="info"
182
183
  >
183
184
  <template v-slot:title>
@@ -27,8 +27,9 @@
27
27
  <farm-btn
28
28
  v-if="link"
29
29
  icon
30
- color="primary"
31
30
  class="farm-btn--clickable"
31
+ title="Ver mais"
32
+ :color="buttonsColor"
32
33
  @click="$emit('onLinkClick')"
33
34
  >
34
35
  <farm-icon size="16px">open-in-new</farm-icon>
@@ -44,7 +45,8 @@
44
45
  sizeIcon="16px"
45
46
  :toCopy="copyText"
46
47
  :successMessage="successMessage"
47
- :tooltipColor="tooltipColor"
48
+ :buttonColor="buttonsColor"
49
+ :tooltipColor="tooltipColor || buttonsColor"
48
50
  />
49
51
  </farm-caption>
50
52
  </div>
@@ -83,6 +85,26 @@ export default Vue.extend({
83
85
  >,
84
86
  default: 'secondary-golden',
85
87
  },
88
+ /**
89
+ * Buttons Color (change from link and copy to clipboard)
90
+ */
91
+ buttonsColor: {
92
+ type: String as PropType<
93
+ | 'primary'
94
+ | 'secondary-green'
95
+ | 'secondary-golden'
96
+ | 'secondary'
97
+ | 'neutral'
98
+ | 'info'
99
+ | 'success'
100
+ | 'error'
101
+ | 'warning'
102
+ | 'extra-1'
103
+ | 'extra-2'
104
+ | 'gray'
105
+ >,
106
+ default: 'primary',
107
+ },
86
108
  /**
87
109
  * Text to be copied to clipboard
88
110
  */
@@ -121,7 +143,7 @@ export default Vue.extend({
121
143
  | 'extra-1'
122
144
  | 'extra-2'
123
145
  >,
124
- default: 'secondary',
146
+ default: 'primary',
125
147
  },
126
148
  /**
127
149
  * noHeight remove min-height of 48px
@@ -3,42 +3,18 @@
3
3
  flex-direction: column;
4
4
  }
5
5
 
6
+ $colorsList: success, error, info;
7
+
6
8
  .logger__divider {
7
9
  height: 40px;
8
10
  margin: -4px 0 -4px 16px;
9
11
  width: 1px;
10
12
 
11
- &.logger__divider--success-to-success {
12
- background: var(--farm-primary-base);
13
- }
14
-
15
- &.logger__divider--error-to-error {
16
- background: var(--farm-error-base);
17
- }
18
-
19
- &.logger__divider--info-to-info {
20
- background: var(--farm-info-base);
21
- }
22
-
23
- &.logger__divider--success-to-error {
24
- background: linear-gradient(to bottom, var(--farm-primary-base), var(--farm-error-base));
25
- }
26
- &.logger__divider--success-to-info {
27
- background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-info-base));
28
- }
29
-
30
- &.logger__divider--error-to-success {
31
- background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-primary-base));
32
- }
33
- &.logger__divider--error-to-info {
34
- background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-info-base));
35
- }
36
-
37
- &.logger__divider--info-to-success {
38
- background: linear-gradient(to bottom, var(--farm-info-base), var(--farm-primary-base));
39
- }
40
- &.logger__divider--info-to-error {
41
- background: linear-gradient(to bottom, var(--farm-info-base), var(--farm-error-base));
13
+ @each $fromColor in $colorsList {
14
+ @each $toColor in $colorsList {
15
+ &.logger__divider--#{$fromColor}-to-#{$toColor} {
16
+ background: linear-gradient(to bottom, var(--farm-#{$fromColor}-base), var(--farm-#{$toColor}-base));
17
+ }
18
+ }
42
19
  }
43
-
44
20
  }
@@ -62,6 +62,18 @@ export const Primary = () => ({
62
62
  formattedDate: '13/06/2022 20:40',
63
63
  status: 'info',
64
64
  },
65
+ {
66
+ message: 'Aprovado entre as pré elegíveis',
67
+ userName: 'Cleyton Rasta',
68
+ formattedDate: '13/06/2022 20:40',
69
+ status: 'success',
70
+ },
71
+ {
72
+ message: 'Info',
73
+ userName: 'Cleyton Rasta',
74
+ formattedDate: '13/06/2022 20:40',
75
+ status: 'info',
76
+ },
65
77
  ],
66
78
  };
67
79
  },
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  &.logger__item--success {
29
- @include loggerMessage(var(--farm-primary-base));
29
+ @include loggerMessage(var(--farm-success-base));
30
30
  }
31
31
 
32
32
  &.logger__item--info {
@@ -19,7 +19,7 @@ export default {
19
19
  },
20
20
  };
21
21
 
22
- export const Primary = () => ({
22
+ export const Default = () => ({
23
23
  data() {
24
24
  return {
25
25
  item: {
@@ -129,10 +129,10 @@ export const Details = () => ({
129
129
  },
130
130
  {
131
131
  icon: 'book',
132
- message: 'Reprovado entre as pré elegíveis',
132
+ message: 'Info',
133
133
  userName: 'Cleyton Rasta',
134
134
  formattedDate: '13/06/2022 20:40',
135
- status: 'primary',
135
+ status: 'info',
136
136
  details() {
137
137
  alert('Ver Detalhes');
138
138
  },
@@ -77,16 +77,10 @@ export default Vue.extend({
77
77
  return '';
78
78
  }
79
79
 
80
- return this.item.status ? mappingIconKeys[this.item.status] : 'error';
80
+ return this.item.status ? mappingIconKeys[this.item.status] : 'success';
81
81
  },
82
82
  buttonColor(): string {
83
- if (this.item.status === 'success') {
84
- return 'primary';
85
- } else if (this.item.status === 'error') {
86
- return 'error';
87
- }
88
-
89
- return 'primary';
83
+ return this.item.status ? this.item.status : 'success';
90
84
  },
91
85
  hasDetails(): boolean {
92
86
  return !!this.item.details;
@@ -55,7 +55,7 @@ describe('LoggerItem component', () => {
55
55
  status: 'success',
56
56
  },
57
57
  });
58
- expect(component.buttonColor).toEqual('primary');
58
+ expect(component.buttonColor).toEqual('success');
59
59
  });
60
60
 
61
61
  it('Should return error button color', async () => {
@@ -49,3 +49,23 @@ export const InitialValue = () => ({
49
49
  export const MinMax = () => ({
50
50
  template: `<RangeDatePicker inputId="input-custom-id" min="2022-01-17" max="2022-02-15" />`,
51
51
  });
52
+
53
+ export const Reset = () => ({
54
+ data() {
55
+ return {
56
+ date: null,
57
+ };
58
+ },
59
+ methods: {
60
+ click() {
61
+ this.$refs.datepickerExemple.clear();
62
+ },
63
+ },
64
+ template: `<div style="width: 480px">
65
+ <RangeDatePicker ref="datepickerExemple" inputId="input-custom-id" v-model="date" />
66
+ date: {{ date }}
67
+ <farm-btn @click="click">
68
+ reset
69
+ </farm-btn>
70
+ </div>`,
71
+ });
@@ -178,10 +178,9 @@ export default Vue.extend({
178
178
  return true;
179
179
  },
180
180
  isInvertedDate() {
181
- if (this.dateField.length === 2) {
181
+ if ((Array.isArray(this.dateField)) && this.dateField.length === 2) {
182
182
  const firstDate = new Date(this.dateField[0]);
183
183
  const secondDate = new Date(this.dateField[1]);
184
-
185
184
  return firstDate.getTime() > secondDate.getTime();
186
185
  }
187
186
  return false;
@@ -30,7 +30,7 @@ $fontWeights: 100, 200, 300, 400, 500, 600, 700;
30
30
 
31
31
  $bwVariations: 80, 50, 40, 30, 10, 5;
32
32
 
33
- $aligns: start,center,end,auto,baseline,stretch;
34
- $align-contents: start,center,end,space-between,space-around,stretch;
35
- $justifications: start,center,end,space-between,space-around;
36
- $directions: row,row-reverse,column,column-reverse;
33
+ $aligns: start, center, end, auto, baseline, stretch;
34
+ $align-contents: start, center, end, space-between, space-around, stretch;
35
+ $justifications: start, center, end, space-between, space-around;
36
+ $directions: row, row-reverse, column, column-reverse;
@@ -1,24 +1,29 @@
1
1
  $defaultLefts: 0, 4rem, 4rem;
2
+
2
3
  @mixin stickytable($selector, $columns: 1, $lefts: $defaultLefts) {
3
4
  #{$selector} {
4
5
  tbody {
5
6
  font-size: 12px;
6
7
  }
8
+
7
9
  tbody tr:nth-of-type(odd) td {
8
- background-color: var(--farm-bw-black-5);
10
+ background-color: var(--farm-background-base);
9
11
  }
12
+
10
13
  tr td {
11
- background-color: var(--farm-bw-white);
14
+ background-color: var(--farm-background-white);
12
15
  }
13
16
 
14
17
  tr:not(:last-child) td,
15
18
  tr th {
16
19
  border-bottom: none;
17
20
  }
21
+
18
22
  .v-data-table__wrapper {
19
23
  border-top: 1px solid var(--farm-gray-lighten);
20
24
  border-bottom: 1px solid var(--farm-gray-lighten);
21
25
  }
26
+
22
27
  tr td:first-child,
23
28
  th:first-child {
24
29
  &:after {
@@ -30,13 +35,17 @@ $defaultLefts: 0, 4rem, 4rem;
30
35
  }
31
36
  }
32
37
 
33
- &.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:first-child,
34
- &.v-data-table > .v-data-table__wrapper > table > thead > tr > th:first-child {
35
- padding-left: 24px;
38
+ &.v-data-table>.v-data-table__wrapper>table {
39
+
40
+ >tbody>tr>td:first-child,
41
+ >thead>tr>th:first-child {
42
+ padding-left: 24px;
43
+ }
36
44
  }
37
45
 
38
- @if $columns > 0 {
46
+ @if $columns >0 {
39
47
  @for $i from 1 through $columns {
48
+
40
49
  tr td:nth-child(#{$i}),
41
50
  th:nth-child(#{$i}) {
42
51
  position: sticky;
@@ -46,6 +55,7 @@ $defaultLefts: 0, 4rem, 4rem;
46
55
  }
47
56
 
48
57
  @for $i from 1 through $columns {
58
+
49
59
  tr td:nth-child(#{$i}),
50
60
  th:nth-child(#{$i}) {
51
61
  left: nth($lefts, $i);
@@ -53,24 +63,11 @@ $defaultLefts: 0, 4rem, 4rem;
53
63
  }
54
64
  }
55
65
 
56
- tr td:first-child, tr th:first-child {
66
+ tr td:first-child,
67
+ tr th:first-child {
57
68
  padding-left: 24px;
58
69
  }
59
70
 
60
- .v-chip {
61
- font-size: 0.75rem;
62
- padding: 0 1.5rem;
63
- }
64
-
65
- .v-pagination {
66
- li button:not([disabled]):not(.v-pagination__item--active):hover {
67
- opacity: 0.6;
68
- }
69
- li button.v-pagination__item--active:hover {
70
- cursor: default;
71
- }
72
- }
73
-
74
71
  th[role='columnheader'] {
75
72
  color: var(--farm-secondary-green-darken);
76
73
  font-size: 14px;
@@ -93,10 +90,6 @@ $defaultLefts: 0, 4rem, 4rem;
93
90
  padding-left: 24px;
94
91
  }
95
92
 
96
- .v-data-table-header tr th {
97
- box-shadow: 0px 1px 0px 0px var(--farm-gray-lighten);
98
- }
99
-
100
93
  .v-data-table-header__icon {
101
94
  color: var(--farm-gray-base) !important;
102
95
  font-size: 12px;
@@ -116,6 +109,6 @@ $defaultLefts: 0, 4rem, 4rem;
116
109
  margin-right: 0 !important;
117
110
  }
118
111
 
119
-
112
+
120
113
  }
121
- }
114
+ }