@farm-investimentos/front-mfe-components 13.1.1 → 14.0.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": "13.1.1",
3
+ "version": "14.0.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -1,4 +1,11 @@
1
1
  @import '../TextFieldV2/TextFieldV2.scss';
2
+ @import '../../configurations/mixins';
3
+
4
+ .farm-select {
5
+ &__hint-text {
6
+ @include hintText;
7
+ }
8
+ }
2
9
 
3
10
  .farm-listitem--selected {
4
11
  background-color: var(--farm-neutral-lighten);
@@ -78,6 +78,40 @@ export const Readonly = () => ({
78
78
  </div>`,
79
79
  });
80
80
 
81
+ export const HintText = () => ({
82
+ data() {
83
+ return {
84
+ v: 1,
85
+ items: [
86
+ { value: 1, text: ' value 1' },
87
+ { value: 2, text: ' value 2' },
88
+ { value: 3, text: ' value 3' },
89
+ ],
90
+ };
91
+ },
92
+ template: `<div style="width: 480px">
93
+ <farm-select v-model="v" :items="items" hint="Hint Text" :persistent-hint="false" />
94
+ v-model: {{ v }}
95
+ </div>`,
96
+ });
97
+
98
+ export const PersistentHintText = () => ({
99
+ data() {
100
+ return {
101
+ v: 1,
102
+ items: [
103
+ { value: 1, text: ' value 1' },
104
+ { value: 2, text: ' value 2' },
105
+ { value: 3, text: ' value 3' },
106
+ ],
107
+ };
108
+ },
109
+ template: `<div style="width: 480px">
110
+ <farm-select v-model="v" :items="items" hint="Hint Text" />
111
+ v-model: {{ v }}
112
+ </div>`,
113
+ });
114
+
81
115
  export const Disabled = () => ({
82
116
  data() {
83
117
  return {
@@ -49,9 +49,12 @@
49
49
  v-bind="$attrs"
50
50
  :id="$props.id"
51
51
  v-model="selectedText"
52
+ ref="inputField"
52
53
  @click="clickInput"
53
54
  @keyup="onKeyUp"
54
55
  @blur="onBlur"
56
+ @focusin="onFocus(true)"
57
+ @focusout="onFocus(false)"
55
58
  />
56
59
  <farm-icon color="gray" :class="{ 'farm-icon--rotate': isVisible }">
57
60
  menu-down
@@ -62,7 +65,15 @@
62
65
  <farm-caption v-if="showErrorText" color="error" variation="regular">
63
66
  {{ errorBucket[0] }}
64
67
  </farm-caption>
65
- <farm-caption v-if="hint && !showErrorText" color="gray" variation="regular">
68
+ <farm-caption
69
+ v-if="hint && !showErrorText"
70
+ class="farm-select__hint-text"
71
+ :class="{
72
+ 'farm-select__hint-text--show': persistentHint || isFocus,
73
+ }"
74
+ color="gray"
75
+ variation="regular"
76
+ >
66
77
  {{ hint }}
67
78
  </farm-caption>
68
79
  </div>
@@ -89,6 +100,13 @@ export default Vue.extend({
89
100
  type: String,
90
101
  default: null,
91
102
  },
103
+ /**
104
+ * Always show hint text
105
+ */
106
+ persistentHint: {
107
+ type: Boolean,
108
+ default: true,
109
+ },
92
110
  /**
93
111
  * Disabled the input
94
112
  */
@@ -201,12 +219,14 @@ export default Vue.extend({
201
219
  const { rules, items, itemText, itemValue, disabled, multiple } = toRefs(props);
202
220
  const innerValue = ref(props.value);
203
221
  const isTouched = ref(false);
222
+ const isFocus = ref(false);
204
223
  const isBlured = ref(false);
205
224
  const isVisible = ref(false);
206
225
  const selectedText = ref('');
207
226
  const multipleValues = ref(Array.isArray(props.value) ? [...props.value] : []);
208
227
  const checked = ref('1');
209
228
  const notChecked = ref(false);
229
+ const inputField = ref();
210
230
 
211
231
  const { errorBucket, valid, validatable } = validateFormStateBuilder();
212
232
 
@@ -290,7 +310,12 @@ export default Vue.extend({
290
310
  emit('blur', event);
291
311
  };
292
312
 
313
+ const onFocus = (focus: boolean) => {
314
+ isFocus.value = focus;
315
+ };
316
+
293
317
  const selectItem = item => {
318
+ inputField.value.focus();
294
319
  if (multiple.value) {
295
320
  const alreadyAdded = multipleValues.value.findIndex(
296
321
  val => val === item[itemValue.value]
@@ -308,6 +333,7 @@ export default Vue.extend({
308
333
 
309
334
  innerValue.value = item[itemValue.value];
310
335
  isVisible.value = false;
336
+
311
337
  setTimeout(() => {
312
338
  emit('change', innerValue.value);
313
339
  }, 100);
@@ -380,6 +406,7 @@ export default Vue.extend({
380
406
  hasError,
381
407
  isTouched,
382
408
  isBlured,
409
+ isFocus,
383
410
  isVisible,
384
411
  customId,
385
412
  showErrorText,
@@ -388,6 +415,7 @@ export default Vue.extend({
388
415
  selectItem,
389
416
  onKeyUp,
390
417
  onBlur,
418
+ onFocus,
391
419
  clickInput,
392
420
  updateSelectedTextValue,
393
421
  makePristine,
@@ -396,6 +424,7 @@ export default Vue.extend({
396
424
  isChecked,
397
425
  multipleValues,
398
426
  addLabelToMultiple,
427
+ inputField,
399
428
  };
400
429
  },
401
430
  });
@@ -1,3 +1,5 @@
1
+ @import '../../configurations/mixins';
2
+
1
3
  .farm-textarea {
2
4
  min-height: 64px;
3
5
 
@@ -18,8 +20,7 @@
18
20
  background-color: white;
19
21
  width: 100%;
20
22
 
21
-
22
- &>textarea {
23
+ & > textarea {
23
24
  flex: 1;
24
25
  outline: none;
25
26
  color: var(--farm-text-primary);
@@ -39,6 +40,10 @@
39
40
  .farm-caption {
40
41
  line-height: 12px;
41
42
  }
43
+
44
+ &__hint-text {
45
+ @include hintText;
46
+ }
42
47
  }
43
48
 
44
49
  .farm-textarea--touched.farm-textarea--validatable {
@@ -47,7 +52,7 @@
47
52
  &--textarea {
48
53
  border-color: var(--farm-error-base);
49
54
 
50
- &>textarea {
55
+ & > textarea {
51
56
  color: var(--farm-neutral-darken);
52
57
  }
53
58
  }
@@ -59,8 +64,8 @@
59
64
  .farm-textarea--textarea {
60
65
  border-color: var(--farm-primary-base);
61
66
 
62
- &>textarea {
67
+ & > textarea {
63
68
  color: var(--farm-neutral-darken);
64
69
  }
65
70
  }
66
- }
71
+ }
@@ -107,6 +107,17 @@ export const HintText = () => ({
107
107
  </div>`,
108
108
  });
109
109
 
110
+ export const PersistentHintText = () => ({
111
+ data() {
112
+ return {
113
+ v: 'input text',
114
+ };
115
+ },
116
+ template: `<div style="width: 480px; display: flex;">
117
+ <farm-textarea v-model="v" hint="Hint text" persistent-hint />
118
+ </div>`,
119
+ });
120
+
110
121
  export const Reset = () => ({
111
122
  data() {
112
123
  return {
@@ -133,4 +144,4 @@ export const Reset = () => ({
133
144
  <farm-btn @click="reset">reset</farm-btn>
134
145
 
135
146
  </div>`,
136
- });
147
+ });
@@ -26,12 +26,22 @@
26
26
  @click="$emit('click')"
27
27
  @keyup="onKeyUp"
28
28
  @blur="onBlur"
29
+ @focusin="onFocus(true)"
30
+ @focusout="onFocus(false)"
29
31
  />
30
32
  </div>
31
33
  <farm-caption v-if="showErrorText" color="error" variation="regular">
32
34
  {{ errorBucket[0] }}
33
35
  </farm-caption>
34
- <farm-caption v-if="hint && !showErrorText" color="gray" variation="regular">
36
+ <farm-caption
37
+ v-if="hint && !showErrorText"
38
+ class="farm-textarea__hint-text"
39
+ :class="{
40
+ 'farm-textarea__hint-text--show': persistentHint || isFocus,
41
+ }"
42
+ color="gray"
43
+ variation="regular"
44
+ >
35
45
  {{ hint }}
36
46
  </farm-caption>
37
47
  </div>
@@ -60,6 +70,13 @@ export default Vue.extend({
60
70
  type: String,
61
71
  default: null,
62
72
  },
73
+ /**
74
+ * Always show hint text
75
+ */
76
+ persistentHint: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
63
80
  /**
64
81
  * Disabled the input
65
82
  */
@@ -109,6 +126,7 @@ export default Vue.extend({
109
126
  const { rules } = toRefs(props);
110
127
  const innerValue = ref(props.value);
111
128
  const isTouched = ref(false);
129
+ const isFocus = ref(false);
112
130
  const isBlured = ref(false);
113
131
 
114
132
  const { errorBucket, valid, validatable } = validateFormStateBuilder();
@@ -164,6 +182,10 @@ export default Vue.extend({
164
182
  emit('blur', event);
165
183
  };
166
184
 
185
+ const onFocus = (focus: boolean) => {
186
+ isFocus.value = focus;
187
+ };
188
+
167
189
  const reset = () => {
168
190
  innerValue.value = '';
169
191
  isTouched.value = true;
@@ -184,10 +206,12 @@ export default Vue.extend({
184
206
  customId,
185
207
  isTouched,
186
208
  isBlured,
209
+ isFocus,
187
210
  showErrorText,
188
211
  validate,
189
212
  onKeyUp,
190
213
  onBlur,
214
+ onFocus,
191
215
  reset,
192
216
  makePristine,
193
217
  };
@@ -1,3 +1,5 @@
1
+ @import '../../configurations/mixins';
2
+
1
3
  .farm-textfield {
2
4
  height: 64px;
3
5
 
@@ -50,6 +52,10 @@
50
52
  .farm-caption {
51
53
  line-height: 12px;
52
54
  }
55
+
56
+ &__hint-text {
57
+ @include hintText;
58
+ }
53
59
  }
54
60
 
55
61
  .farm-textfield--touched.farm-textfield--validatable {
@@ -133,6 +133,17 @@ export const HintText = () => ({
133
133
  </div>`,
134
134
  });
135
135
 
136
+ export const PersistentHintText = () => ({
137
+ data() {
138
+ return {
139
+ v: 'input text',
140
+ };
141
+ },
142
+ template: `<div style="width: 480px; display: flex;">
143
+ <farm-textfield-v2 v-model="v" hint="Hint text" persistent-hint />
144
+ </div>`,
145
+ });
146
+
136
147
  export const UpdateValue = () => ({
137
148
  data() {
138
149
  return {
@@ -36,6 +36,8 @@
36
36
  @click="$emit('click')"
37
37
  @keyup="onKeyUp"
38
38
  @blur="onBlur"
39
+ @focusin="onFocus(true)"
40
+ @focusout="onFocus(false)"
39
41
  />
40
42
  <button
41
43
  type="button"
@@ -50,6 +52,10 @@
50
52
  </farm-caption>
51
53
  <farm-caption
52
54
  v-if="!hideDetails && hint && !showErrorText"
55
+ class="farm-textfield__hint-text"
56
+ :class="{
57
+ 'farm-textfield__hint-text--show': persistentHint || isFocus,
58
+ }"
53
59
  color="gray"
54
60
  variation="regular"
55
61
  >
@@ -92,6 +98,13 @@ export default Vue.extend({
92
98
  type: String,
93
99
  default: null,
94
100
  },
101
+ /**
102
+ * Always show hint text
103
+ */
104
+ persistentHint: {
105
+ type: Boolean,
106
+ default: false,
107
+ },
95
108
  /**
96
109
  * Disabled the input
97
110
  */
@@ -160,6 +173,7 @@ export default Vue.extend({
160
173
  const innerValue = ref(props.value);
161
174
  const isTouched = ref(false);
162
175
  const isBlured = ref(false);
176
+ const isFocus = ref(false);
163
177
  const isUppercase = ref(props.uppercase);
164
178
 
165
179
  const { errorBucket, valid, validatable } = validateFormStateBuilder();
@@ -218,6 +232,10 @@ export default Vue.extend({
218
232
  emit('blur', event);
219
233
  };
220
234
 
235
+ const onFocus = (focus: boolean) => {
236
+ isFocus.value = focus;
237
+ };
238
+
221
239
  const reset = () => {
222
240
  innerValue.value = '';
223
241
  isTouched.value = true;
@@ -239,10 +257,12 @@ export default Vue.extend({
239
257
  isTouched,
240
258
  isBlured,
241
259
  isUppercase,
260
+ isFocus,
242
261
  showErrorText,
243
262
  validate,
244
263
  onKeyUp,
245
264
  onBlur,
265
+ onFocus,
246
266
  reset,
247
267
  makePristine,
248
268
  };
@@ -78,9 +78,9 @@ export const Visibility = () => ({
78
78
  some <em>sample</em> text<br />
79
79
  some <em>sample</em> text<br />
80
80
  <template v-slot:activator="{ on, attrs }">
81
- <v-btn @click="show = !show">
81
+ <farm-btn @click="show = !show">
82
82
  toggle me
83
- </v-btn>
83
+ </farm-btn>
84
84
  </template>
85
85
  </farm-tooltip>
86
86
  </div>`,
@@ -121,29 +121,6 @@ export const TagP = () => ({
121
121
  template: '<farm-col tag="p">col</farm-col>',
122
122
  });
123
123
 
124
- export const CompareToVCol = () => ({
125
- data() {
126
- return {
127
- style,
128
- };
129
- },
130
- template: `<div>
131
-
132
- <h4>LG 3</h4>
133
- <farm-col lg="3" :style="style">farm</farm-col>
134
- <v-col lg="3" :style="style">v-col</v-col>
135
-
136
- <h4>MD 3</h4>
137
- <farm-col md="3" :style="style">farm</farm-col>
138
- <v-col md="3" :style="style">v-col</v-col>
139
-
140
-
141
- <h4>SM 3</h4>
142
- <farm-col sm="3" :style="style">farm</farm-col>
143
- <v-col sm="3" :style="style">v-col</v-col>
144
- </div>`,
145
- });
146
-
147
124
  export const NoGutters = () => ({
148
125
  data() {
149
126
  return {
@@ -1,92 +1,103 @@
1
1
  @mixin forXsOnly {
2
- @media (max-width: 599px) {
3
- @content;
4
- }
2
+ @media (max-width: 599px) {
3
+ @content;
4
+ }
5
5
  }
6
6
 
7
7
  @mixin upToSm {
8
- @media (max-width: 959px) {
9
- @content;
10
- }
8
+ @media (max-width: 959px) {
9
+ @content;
10
+ }
11
11
  }
12
12
 
13
13
  @mixin upToMd {
14
- @media (max-width: 1263px) {
15
- @content;
16
- }
14
+ @media (max-width: 1263px) {
15
+ @content;
16
+ }
17
17
  }
18
18
 
19
19
  @mixin fromXs {
20
- @media (min-width: 600px) {
21
- @content;
22
- }
20
+ @media (min-width: 600px) {
21
+ @content;
22
+ }
23
23
  }
24
24
 
25
25
  @mixin fromSm {
26
- @media (min-width: 960px) {
27
- @content;
28
- }
26
+ @media (min-width: 960px) {
27
+ @content;
28
+ }
29
29
  }
30
30
 
31
31
  @mixin fromMd {
32
- @media (min-width: 1264px) {
33
- @content;
34
- }
32
+ @media (min-width: 1264px) {
33
+ @content;
34
+ }
35
35
  }
36
36
 
37
37
  @mixin fromLg {
38
- @media (min-width: 1904px) {
39
- @content;
40
- }
38
+ @media (min-width: 1904px) {
39
+ @content;
40
+ }
41
41
  }
42
42
 
43
43
  @mixin addShadow {
44
- box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
44
+ box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.16);
45
45
  }
46
46
 
47
47
  @mixin buildCol($code) {
48
- @for $i from 1 through 12 {
49
- .farm-col--#{$code}-#{$i * 1} {
50
- flex: 0 0 (100/12 * $i)+#{"%"};
51
- max-width: (100/12 * $i)+#{"%"};
52
- }
53
- }
48
+ @for $i from 1 through 12 {
49
+ .farm-col--#{$code}-#{$i * 1} {
50
+ flex: 0 0 (100/12 * $i) +#{'%'};
51
+ max-width: (100/12 * $i) +#{'%'};
52
+ }
53
+ }
54
54
  }
55
55
 
56
56
  @mixin rippleStyles {
57
- .farm-ripple {
58
- border-radius: 50%;
59
- cursor: pointer;
60
- position: absolute;
61
- transition: all 0.4s;
62
- z-index: 1;
57
+ .farm-ripple {
58
+ border-radius: 50%;
59
+ cursor: pointer;
60
+ position: absolute;
61
+ transition: all 0.4s;
62
+ z-index: 1;
63
63
 
64
- &:before {
65
- transition: all 0.2s;
66
- border-radius: inherit;
67
- bottom: 0;
68
- content: "";
69
- position: absolute;
70
- opacity: 0;
71
- left: 0;
72
- right: 0;
73
- top: 0;
74
- transform-origin: center center;
75
- background-color: var(--farm-stroke-base);
76
- }
77
- }
64
+ &:before {
65
+ transition: all 0.2s;
66
+ border-radius: inherit;
67
+ bottom: 0;
68
+ content: '';
69
+ position: absolute;
70
+ opacity: 0;
71
+ left: 0;
72
+ right: 0;
73
+ top: 0;
74
+ transform-origin: center center;
75
+ background-color: var(--farm-stroke-base);
76
+ }
77
+ }
78
78
  }
79
79
 
80
80
  @mixin activateRipple {
81
- &:hover {
82
- .farm-ripple:before {
83
- opacity: 0.3;
84
- }
85
- }
81
+ &:hover {
82
+ .farm-ripple:before {
83
+ opacity: 0.3;
84
+ }
85
+ }
86
86
  }
87
87
 
88
88
  @mixin ellipsis {
89
- white-space: nowrap;
90
- overflow: hidden;
91
- text-overflow: ellipsis;
92
- }
89
+ white-space: nowrap;
90
+ overflow: hidden;
91
+ text-overflow: ellipsis;
92
+ }
93
+
94
+ @mixin hintText {
95
+ opacity: 0;
96
+ visibility: hidden;
97
+ transition: opacity 0.3s;
98
+
99
+ &--show {
100
+ opacity: 1;
101
+ visibility: visible;
102
+ }
103
+ }
package/src/main.ts CHANGED
@@ -9,7 +9,6 @@ import MultipleFilePicker from './components/MultipleFilePicker';
9
9
  import Tabs from './components/Tabs';
10
10
  import DialogHeader from './components/DialogHeader';
11
11
  import DialogFooter from './components/DialogFooter';
12
- import DefaultTextField from './components/DefaultTextField';
13
12
  import RangeDatePicker from './components/RangeDatePicker';
14
13
  import DatePicker from './components/DatePicker';
15
14
  import ManagersList from './components/ManagersList';
@@ -36,7 +35,6 @@ export {
36
35
  Tabs,
37
36
  DialogHeader,
38
37
  DialogFooter,
39
- DefaultTextField,
40
38
  RangeDatePicker,
41
39
  DatePicker,
42
40
  ManagersList,