@farm-investimentos/front-mfe-components 15.4.2 → 15.4.4

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": "15.4.2",
3
+ "version": "15.4.4",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -94,6 +94,19 @@ export const OnlyAllowedDates = () => ({
94
94
  template: `<div style='max-width: 320px'><farm-input-datepicker position="bottom" :allowed-dates="allowedDates" inputId="input-custom-id-1" v-model="date" /></div>`,
95
95
  });
96
96
 
97
+ export const WithInitialMonth = () => ({
98
+ data() {
99
+ return {
100
+ date: '',
101
+ pickerDate: '2023-01'
102
+ };
103
+ },
104
+ template: `<div style='max-width: 320px'>
105
+ <farm-input-datepicker inputId="input-custom-id-0" v-model="date" position="center" :picker-date.sync="pickerDate" />
106
+ {{ date }}
107
+ </div>`,
108
+ });
109
+
97
110
  export const TopPositioned = () => ({
98
111
  data() {
99
112
  return {
@@ -20,6 +20,7 @@
20
20
  :max="max"
21
21
  :min="min"
22
22
  :allowed-dates="allowedDates"
23
+ :picker-date.sync="internalPickerDate"
23
24
  >
24
25
  <farm-btn plain title="Limpar" color="primary" :disabled="isDisabled" @click="clear">
25
26
  Limpar
@@ -112,6 +113,13 @@ export default defineComponent({
112
113
  type: Function,
113
114
  default: () => true,
114
115
  },
116
+ /**
117
+ * Current month/year to show when opened
118
+ */
119
+ pickerDate: {
120
+ type: String,
121
+ default: '',
122
+ },
115
123
  /**
116
124
  * Required field (inside form)
117
125
  */
@@ -127,6 +135,7 @@ export default defineComponent({
127
135
  data() {
128
136
  const s = this.formatDateRange(this.value);
129
137
  return {
138
+ internalPickerDate: this.pickerDate,
130
139
  menuField: false,
131
140
  dateField: this.value,
132
141
  fieldRange: s,
@@ -1,9 +1,41 @@
1
+ $colorsList: success, error, info;
2
+
1
3
  .logger {
2
4
  display: flex;
3
5
  flex-direction: column;
4
- }
5
6
 
6
- $colorsList: success, error, info;
7
+ &--horizontal {
8
+ flex-direction: row;
9
+ gap: 48px;
10
+
11
+ .logger__divider {
12
+ width: auto;
13
+ min-width: 192px;
14
+ height: 1px;
15
+ margin: 16px -96px 0 -96px;
16
+
17
+ @each $fromColor in $colorsList {
18
+ @each $toColor in $colorsList {
19
+ &.logger__divider--#{$fromColor}-to-#{$toColor} {
20
+ background: linear-gradient(
21
+ to right,
22
+ var(--farm-#{$fromColor}-base),
23
+ var(--farm-#{$toColor}-base)
24
+ );
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+
31
+ &--left-aligned {
32
+ align-items: flex-start;
33
+
34
+ .logger__divider {
35
+ margin: 16px -32px 0 -160px;
36
+ }
37
+ }
38
+ }
7
39
 
8
40
  .logger__divider {
9
41
  height: 40px;
@@ -13,8 +45,12 @@ $colorsList: success, error, info;
13
45
  @each $fromColor in $colorsList {
14
46
  @each $toColor in $colorsList {
15
47
  &.logger__divider--#{$fromColor}-to-#{$toColor} {
16
- background: linear-gradient(to bottom, var(--farm-#{$fromColor}-base), var(--farm-#{$toColor}-base));
48
+ background: linear-gradient(
49
+ to bottom,
50
+ var(--farm-#{$fromColor}-base),
51
+ var(--farm-#{$toColor}-base)
52
+ );
17
53
  }
18
54
  }
19
55
  }
20
- }
56
+ }
@@ -134,3 +134,95 @@ export const Details = () => ({
134
134
  },
135
135
  template: `<farm-logger :items="items" />`,
136
136
  });
137
+
138
+ export const Horizontal = () => ({
139
+ data() {
140
+ return {
141
+ items: [
142
+ {
143
+ message: 'Recusado entre as pré elegíveis',
144
+ userName: 'Cleyton Rasta',
145
+ formattedDate: '13/06/2022 20:40',
146
+ status: 'error',
147
+ details() {
148
+ alert('Ver Detalhes');
149
+ },
150
+ },
151
+ {
152
+ message: 'Aprovado entre as pré elegíveis',
153
+ userName: 'Cleyton Rasta',
154
+ formattedDate: '13/06/2022 20:40',
155
+ status: 'success',
156
+ details() {
157
+ alert('Ver Detalhes');
158
+ },
159
+ },
160
+ {
161
+ message: 'Aprovado entre as pré elegíveis',
162
+ userName: 'Cleyton Rasta',
163
+ formattedDate: '13/06/2022 20:40',
164
+ status: 'success',
165
+ details() {
166
+ alert('Ver Detalhes');
167
+ },
168
+ },
169
+ {
170
+ message: 'Recusado entre as pré elegíveis',
171
+ userName: 'Cleyton Rasta',
172
+ formattedDate: '13/06/2022 20:40',
173
+ status: 'error',
174
+ details() {
175
+ alert('Ver Detalhes');
176
+ },
177
+ }
178
+ ],
179
+ };
180
+ },
181
+ template: `<farm-logger :items="items" :vertical="false" />`,
182
+ });
183
+
184
+ export const HorizontalLeftAligned = () => ({
185
+ data() {
186
+ return {
187
+ items: [
188
+ {
189
+ message: 'Recusado entre as pré elegíveis',
190
+ userName: 'Cleyton Rasta',
191
+ formattedDate: '13/06/2022 20:40',
192
+ status: 'error',
193
+ details() {
194
+ alert('Ver Detalhes');
195
+ },
196
+ },
197
+ {
198
+ message: 'Aprovado entre as pré elegíveis',
199
+ userName: 'Cleyton Rasta',
200
+ formattedDate: '13/06/2022 20:40',
201
+ status: 'success',
202
+ details() {
203
+ alert('Ver Detalhes');
204
+ },
205
+ },
206
+ {
207
+ message: 'Aprovado entre as pré elegíveis',
208
+ userName: 'Cleyton Rasta',
209
+ formattedDate: '13/06/2022 20:40',
210
+ status: 'success',
211
+ details() {
212
+ alert('Ver Detalhes');
213
+ },
214
+ },
215
+ {
216
+ message: 'Recusado entre as pré elegíveis',
217
+ userName: 'Cleyton Rasta',
218
+ formattedDate: '13/06/2022 20:40',
219
+ status: 'error',
220
+ details() {
221
+ alert('Ver Detalhes');
222
+ },
223
+ }
224
+ ],
225
+ };
226
+ },
227
+ template: `<farm-logger :items="items" :vertical="false" align="left" />`,
228
+ });
@@ -1,7 +1,17 @@
1
1
  <template>
2
- <section class="logger">
2
+ <section
3
+ class="logger"
4
+ :class="{ 'logger--horizontal': !vertical, 'logger--left-aligned': align === 'left' }"
5
+ >
3
6
  <template v-for="(item, index) in items">
4
- <farm-logger-item :item="item" :key="`logger_item_${index}`" />
7
+ <farm-logger-item
8
+ :item="item"
9
+ :key="`logger_item_${index}`"
10
+ :class="{
11
+ 'logger__item--horizontal': !vertical,
12
+ 'logger__item--left-aligned': align === 'left',
13
+ }"
14
+ />
5
15
  <div
6
16
  v-if="hasDivider(index)"
7
17
  :class="{
@@ -24,6 +34,14 @@ export default defineComponent({
24
34
  * List of logger items
25
35
  */
26
36
  items: { required: true, type: Array as PropType<Array<ILoggerItem>> },
37
+ /**
38
+ * Vertical or horizontal
39
+ */
40
+ vertical: { type: Boolean, default: true },
41
+ /**
42
+ * Items alignment
43
+ */
44
+ align: { type: String as PropType<'center' | 'left'>, default: 'center' },
27
45
  },
28
46
  methods: {
29
47
  hasDivider(index: number): boolean {
@@ -19,6 +19,35 @@
19
19
  display: flex;
20
20
  flex-direction: column;
21
21
  padding-left: 8px;
22
+
23
+ .logger__item--spacing-bottom {
24
+ margin-bottom: 8px;
25
+ }
26
+ }
27
+
28
+ > .farm-icon {
29
+ border: 1px solid var(--farm-stroke-base);
30
+ border-radius: 50%;
31
+ min-width: 32px;
32
+ min-height: 32px;
33
+ width: 32px;
34
+ height: 32px;
35
+ display: block;
36
+
37
+ display: flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+
41
+ border-color: var(--farm-neutral-base);
42
+ background-color: var(--farm-neutral-base);
43
+
44
+ &:before {
45
+ color: white;
46
+ }
47
+ }
48
+
49
+ > .farm-btn.logger__item--button {
50
+ margin-left: 8px;
22
51
  }
23
52
 
24
53
  &.logger__item--error {
@@ -32,31 +61,39 @@
32
61
  &.logger__item--info {
33
62
  @include loggerMessage(var(--farm-info-base));
34
63
  }
35
- }
36
64
 
37
- .logger__item > .farm-icon {
38
- border: 1px solid var(--farm-stroke-base);
39
- border-radius: 50%;
40
- width: 32px;
41
- height: 32px;
42
- display: block;
65
+ &--horizontal {
66
+ flex-direction: column;
67
+ height: auto;
68
+ width: 158px;
43
69
 
44
- display: flex;
45
- align-items: center;
46
- justify-content: center;
70
+ > div {
71
+ align-items: center;
72
+ text-align: center;
73
+ gap: 8px;
74
+ margin-bottom: 8px;
75
+ padding-left: 0;
47
76
 
48
- border-color: var(--farm-neutral-base);
49
- background-color: var(--farm-neutral-base);
77
+ .logger__item--spacing-bottom {
78
+ margin-bottom: 0;
79
+ }
80
+ }
50
81
 
51
- &:before {
52
- color: white;
82
+ > .farm-icon {
83
+ margin-bottom: 8px;
84
+ }
85
+
86
+ > .farm-btn.logger__item--button {
87
+ margin-left: 0;
88
+ }
53
89
  }
54
- }
55
90
 
56
- .logger__item > .farm-btn.logger__item--button {
57
- margin-left: 8px;
58
- }
91
+ &--left-aligned {
92
+ align-items: flex-start;
59
93
 
60
- .logger__item > div .logger__item--spacing-bottom {
61
- margin-bottom: 8px;
94
+ > div {
95
+ align-items: flex-start;
96
+ text-align: left;
97
+ }
98
+ }
62
99
  }
@@ -28,12 +28,13 @@
28
28
  variation="regular"
29
29
  color="black"
30
30
  colorVariation="50"
31
+ class="logger__item--user"
31
32
  v-if="item.userName"
32
33
  >
33
34
  <farm-icon color="black" variation="50" size="xs">account-circle</farm-icon>
34
35
  {{ item.userName }}
35
36
  </farm-bodysmall>
36
- <farm-caption variation="regular">
37
+ <farm-caption variation="regular" v-if="item.extraMessage">
37
38
  {{ item.extraMessage }}
38
39
  </farm-caption>
39
40
  </div>
@@ -61,6 +62,10 @@ export default defineComponent({
61
62
  * Logger item
62
63
  */
63
64
  item: { required: true, type: Object as PropType<ILoggerItem> },
65
+ /**
66
+ * Vertical or horizontal
67
+ */
68
+ vertical: { type: Boolean, default: true },
64
69
  customIcon: { type: String, required: false },
65
70
  },
66
71
  methods: {
@@ -376,8 +376,8 @@ export default defineComponent({
376
376
  if (!selectedText.value) {
377
377
  innerValue.value = null;
378
378
  }
379
- searchText.value = '';
380
379
  }
380
+ searchText.value = '';
381
381
  updateSelectedTextValue();
382
382
  }
383
383
  };