@farm-investimentos/front-mfe-components 11.6.0 → 11.6.2

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": "11.6.0",
3
+ "version": "11.6.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -7,7 +7,8 @@ export default {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Confirm button<br />
10
- selector: <em>farm-btn-confirm</em>
10
+ selector: <em>farm-btn-confirm</em><br />
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
11
12
  `,
12
13
  },
13
14
  },
@@ -16,22 +17,18 @@ export default {
16
17
  };
17
18
 
18
19
  export const Primary = () => ({
19
- components: { ConfirmButton },
20
20
  template: '<ConfirmButton>Confirm Button</ConfirmButton>',
21
21
  });
22
22
 
23
23
  export const HtmlMarkup = () => ({
24
- components: { ConfirmButton },
25
24
  template: '<ConfirmButton><em>I am italic</strong></em></ConfirmButton>',
26
25
  });
27
26
 
28
27
  export const Props = () => ({
29
- components: { ConfirmButton },
30
28
  template: '<ConfirmButton title="custom title">custom title (hover me)</ConfirmButton>',
31
29
  });
32
30
 
33
31
  export const Listener = () => ({
34
- components: { ConfirmButton },
35
32
  data() {
36
33
  return {
37
34
  x: 1,
@@ -48,11 +45,6 @@ export const Iconed = () => ({
48
45
  <ConfirmButton :icon="true">default icon</ConfirmButton>
49
46
  <ConfirmButton :icon="true" customIcon="information-outline">information-outline</ConfirmButton>
50
47
  <ConfirmButton :icon="true" customIcon="account-search">account-search</ConfirmButton>
48
+ <ConfirmButton :icon="true" customIcon="account-search" disabled>account-search</ConfirmButton>
51
49
  </div>`,
52
- });
53
-
54
- Primary.storyName = 'Básico';
55
- HtmlMarkup.storyName = 'Html Markup';
56
- Props.storyName = 'Props';
57
- Listener.storyName = 'Listener';
58
- Iconed.storyName = 'Icon';
50
+ });
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <farm-btn v-bind="$attrs" v-on="$listeners">
3
- <i :class="{ mdi: true, [iconPath]: true, 'mr-3': true }" v-if="icon"></i>
3
+ <farm-icon v-if="icon" class="'mr-3">
4
+ {{ customIcon }}
5
+ </farm-icon>
4
6
  <slot></slot>
5
7
  </farm-btn>
6
8
  </template>
@@ -23,21 +25,9 @@ export default Vue.extend({
23
25
  */
24
26
  customIcon: {
25
27
  type: String,
26
- default: '',
27
- },
28
- },
29
- computed: {
30
- iconPath() {
31
- if (!this.customIcon) {
32
- return 'mdi-check';
33
- }
34
- return `mdi-${this.customIcon}`;
28
+ default: 'check',
35
29
  },
36
30
  },
37
31
  });
38
32
  </script>
39
- <style lang="scss" scoped>
40
- i.mdi {
41
- font-size: 1rem;
42
- }
43
- </style>
33
+
@@ -3,31 +3,12 @@ import ConfirmButton from '../ConfirmButton';
3
3
 
4
4
  describe('ConfirmButton component', () => {
5
5
  let wrapper;
6
- let component;
7
6
 
8
7
  beforeEach(() => {
9
8
  wrapper = shallowMount(ConfirmButton);
10
- component = wrapper.vm;
11
9
  });
12
10
 
13
11
  test('Created hook', () => {
14
12
  expect(wrapper).toBeDefined();
15
13
  });
16
-
17
- describe('Computed properties', () => {
18
- it('Should return default icon', () => {
19
- wrapper.setProps({
20
- icon: true,
21
- });
22
- expect(component.iconPath).toEqual('mdi-check');
23
- });
24
-
25
- it('Should return custom icon', async () => {
26
- await wrapper.setProps({
27
- icon: true,
28
- customIcon: 'information',
29
- });
30
- expect(component.iconPath).toEqual('mdi-information');
31
- });
32
- });
33
14
  });
@@ -7,7 +7,8 @@ export default {
7
7
  docs: {
8
8
  description: {
9
9
  component: `Danger button<br />
10
- selector: <em>farm-btn-fanger</em>
10
+ selector: <em>farm-btn-fanger</em><br />
11
+ <span style="color: var(--farm-primary-base);">ready for use</span>
11
12
  `,
12
13
  },
13
14
  },
@@ -43,5 +44,6 @@ export const Iconed = () => ({
43
44
  <farm-btn-danger :icon="true">default icon</farm-btn-danger>
44
45
  <farm-btn-danger :icon="true" customIcon="information-outline">information-outline</farm-btn-danger>
45
46
  <farm-btn-danger :icon="true" customIcon="account-search">account-search</farm-btn-danger>
47
+ <farm-btn-danger :icon="true" customIcon="account-search" disabled>account-search</farm-btn-danger>
46
48
  </div>`,
47
49
  });
@@ -1,6 +1,8 @@
1
1
  <template>
2
2
  <farm-btn v-bind="$attrs" v-on="$listeners" color="error">
3
- <i v-if="icon" :class="{mdi: true, [iconPath]: true, 'mr-3': true}"></i>
3
+ <farm-icon v-if="icon" class="'mr-3">
4
+ {{ customIcon }}
5
+ </farm-icon>
4
6
  <slot></slot>
5
7
  </farm-btn>
6
8
  </template>
@@ -26,13 +28,5 @@ export default Vue.extend({
26
28
  default: '',
27
29
  },
28
30
  },
29
- computed: {
30
- iconPath(): string {
31
- if (!this.customIcon) {
32
- return 'mdi-trash-can-outline';
33
- }
34
- return `mdi-${this.customIcon}`;
35
- },
36
- },
37
31
  });
38
32
  </script>
@@ -3,31 +3,12 @@ import DangerButton from '../DangerButton';
3
3
 
4
4
  describe('DangerButton component', () => {
5
5
  let wrapper;
6
- let component;
7
6
 
8
7
  beforeEach(() => {
9
8
  wrapper = shallowMount(DangerButton);
10
- component = wrapper.vm;
11
9
  });
12
10
 
13
11
  test('Created hook', () => {
14
12
  expect(wrapper).toBeDefined();
15
13
  });
16
-
17
- describe('Computed properties', () => {
18
- it('Should return default icon', () => {
19
- wrapper.setProps({
20
- icon: true,
21
- });
22
- expect(component.iconPath).toEqual('mdi-trash-can-outline');
23
- });
24
-
25
- it('Should return custom icon', async () => {
26
- await wrapper.setProps({
27
- icon: true,
28
- customIcon: 'information',
29
- });
30
- expect(component.iconPath).toEqual('mdi-information');
31
- });
32
- });
33
14
  });
@@ -41,3 +41,25 @@ export const CustomTooltipColor = () => ({
41
41
  <farm-copytoclipboard toCopy="To be copied" tooltip-color="info" />
42
42
  </div>`,
43
43
  });
44
+
45
+ export const Modal = () => ({
46
+ data() {
47
+ return {
48
+ value: false,
49
+ };
50
+ },
51
+ template: `<div>
52
+ <farm-btn @click="value = true">abrir</farm-btn>
53
+ <farm-modal v-model="value">
54
+ <template v-slot:content>
55
+ <farm-copytoclipboard toCopy="To be copied" :isIcon="false" />
56
+ </template>
57
+ </farm-modal>
58
+ </div>`,
59
+ });
60
+
61
+ export const SuccessTimeout = () => ({
62
+ template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
63
+ <farm-copytoclipboard toCopy="To be copied" success-timeout="5000" />
64
+ </div>`,
65
+ });
@@ -53,12 +53,19 @@ export default Vue.extend({
53
53
  >,
54
54
  default: 'secondary',
55
55
  },
56
+ /**
57
+ * Success message timeout (in ms)
58
+ */
59
+ successTimeout: {
60
+ type: [Number, String],
61
+ default: 2000,
62
+ },
56
63
  },
57
64
  setup(props) {
58
65
  const show = ref(false);
59
66
  const feedbackMessage = ref('');
60
67
  const disabled = ref(false);
61
- const { toCopy, isIcon, successMessage } = toRefs(props);
68
+ const { toCopy, isIcon, successMessage, successTimeout } = toRefs(props);
62
69
 
63
70
  const onClick = async () => {
64
71
  disabled.value = true;
@@ -73,7 +80,7 @@ export default Vue.extend({
73
80
  setTimeout(() => {
74
81
  show.value = false;
75
82
  disabled.value = false;
76
- }, 2000);
83
+ }, successTimeout.value);
77
84
  };
78
85
 
79
86
  return {
@@ -257,7 +257,7 @@ export const Grid = () => ({
257
257
  </farm-col>
258
258
  <farm-col cols="12" md="3">
259
259
  <farm-label>Label 3</farm-label>
260
- <farm-textfield />
260
+ <farm-textfield hint="some hint text" persistent-hint="true" />
261
261
  </farm-col>
262
262
  <farm-col cols="12" md="3">
263
263
  <farm-label>Label 4</farm-label>
@@ -9,7 +9,7 @@
9
9
  height: 36px;
10
10
  border-radius: 5px;
11
11
  padding: 8px;
12
- margin-bottom: 8px;
12
+ margin-bottom: 4px;
13
13
 
14
14
  > button {
15
15
  display: flex;
@@ -20,7 +20,7 @@ export default {
20
20
  description: {
21
21
  component: `Text field v2<br />
22
22
  selector: <em>farm-texfield-v2</em><br />
23
- <span style="color: var(--farm-extra-1-base);">development</span>
23
+ <span style="color: var(--farm-primary-base);">ready for use</span>
24
24
  `,
25
25
  },
26
26
  },
@@ -229,3 +229,27 @@ export const ToggleVisibility = () => ({
229
229
  <farm-textfield-v2 v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
230
230
  </div>`,
231
231
  });
232
+
233
+
234
+ export const Compare = () => ({
235
+ data() {
236
+ return {
237
+ v1: '',
238
+ rules: {
239
+ required: value => !!value || 'Required field',
240
+ email: v =>
241
+ !v ||
242
+ /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
243
+ 'Must be an e-mail',
244
+ },
245
+ };
246
+ },
247
+ template: `<div style="width: 480px">
248
+
249
+ <farm-label required>Required and e-mail</farm-label>
250
+ <farm-textfield-v2 v-model="v1" :rules="[rules.required, rules.email]" />
251
+
252
+ <farm-textfield v-model="v1" :rules="[rules.required, rules.email]" />
253
+
254
+ </div>`,
255
+ });
@@ -21,6 +21,7 @@
21
21
  </template>
22
22
  <script lang="ts">
23
23
  import Vue, { PropType, ref, computed, reactive, onBeforeUnmount } from 'vue';
24
+ import { calculateMainZindex } from '../../helpers';
24
25
 
25
26
  export default Vue.extend({
26
27
  name: 'farm-tooltip',
@@ -60,6 +61,7 @@ export default Vue.extend({
60
61
  const styles = reactive({
61
62
  left: '0',
62
63
  top: '0',
64
+ zIndex: 1,
63
65
  });
64
66
 
65
67
  const toggleComponent = computed(() => props.value);
@@ -86,7 +88,8 @@ export default Vue.extend({
86
88
  window.scrollY -
87
89
  (popupBoundingClientRect.height + 8) +
88
90
  'px';
89
-
91
+ styles.zIndex = calculateMainZindex();
92
+
90
93
  hasBeenBoostrapped = true;
91
94
  }
92
95
  };
@@ -39,10 +39,4 @@
39
39
  margin-top: 12px;
40
40
  margin-bottom: 12px;
41
41
  }
42
-
43
- &--y-form-gutters > .farm-col {
44
- margin-top: 12px;
45
- margin-bottom: -12px;
46
- }
47
-
48
42
  }
@@ -110,34 +110,3 @@ export const yGridGutters = () => ({
110
110
  </farm-row>
111
111
  </div>`,
112
112
  });
113
-
114
- export const yFormGutters = () => ({
115
- template: `<div>
116
- <farm-row y-form-gutters>
117
- <farm-col md="6">
118
- <div style="border:1px solid red;">
119
- <farm-label>label 1</farm-label>
120
- <farm-textfield />
121
- </div>
122
- </farm-col>
123
- <farm-col md="6">
124
- <div style="border:1px solid red;">
125
- <farm-label>label 2</farm-label>
126
- <farm-textfield />
127
- </div>
128
- </farm-col>
129
- <farm-col md="6">
130
- <div style="border:1px solid red;">
131
- <farm-label>label 3</farm-label>
132
- <farm-textfield hint="some hint text" persistent-hint />
133
- </div>
134
- </farm-col>
135
- <farm-col md="6">
136
- <div style="border:1px solid red;">
137
- <farm-label>label 4</farm-label>
138
- <farm-textfield />
139
- </div>
140
- </farm-col>
141
- </farm-row>
142
- </div>`,
143
- });
@@ -9,7 +9,6 @@
9
9
  'farm-row--no-default-gutters': noDefaultGutters,
10
10
  'farm-row--extra-decrease': extraDecrease,
11
11
  'farm-row--y-grid-gutters': yGridGutters,
12
- 'farm-row--y-form-gutters': yFormGutters,
13
12
  }"
14
13
  >
15
14
  <slot></slot>
@@ -69,13 +68,6 @@ export default Vue.extend({
69
68
  type: Boolean,
70
69
  default: false,
71
70
  },
72
- /**
73
- * Add proper gutters to farm-cols in Y axis to be used with form elements
74
- */
75
- yFormGutters: {
76
- type: Boolean,
77
- default: false,
78
- },
79
71
  },
80
72
  inheritAttrs: true,
81
73
  });
@@ -1,7 +1,9 @@
1
1
  .theme--light {
2
+
2
3
  .fieldset-default,
3
4
  .v-col-fieldset-default {
4
5
  border: 0;
6
+
5
7
  label {
6
8
  font-weight: bold;
7
9
  display: block;
@@ -15,49 +17,61 @@
15
17
  .v-input__append-inner {
16
18
  margin-top: 8px;
17
19
  }
20
+
18
21
  .v-input__prepend-inner {
19
22
  margin-top: 8px;
20
23
  }
21
24
  }
25
+
22
26
  .v-input__prepend-outer {
23
27
  margin-top: 8px;
24
28
  }
25
29
  }
30
+
26
31
  &.v-text-field.v-input--dense.v-text-field--outlined {
27
32
  .v-input__slot {
28
33
  min-height: 36px !important;
29
34
  height: 36px;
30
35
  background: white;
36
+
31
37
  fieldset {
32
38
  border-color: var(--v-gray-lighten2);
33
39
  }
40
+
34
41
  input,
35
42
  .v-select__selection {
36
43
  font-size: 0.75rem;
37
44
  }
45
+
38
46
  .v-input__append-inner {
39
47
  margin-top: 8px;
40
48
  }
49
+
41
50
  .v-input__prepend-inner {
42
51
  margin-top: 8px;
43
52
  }
44
53
  }
54
+
45
55
  .v-input__prepend-outer {
46
56
  margin-top: 8px;
47
57
  }
58
+
48
59
  &.v-input--is-label-active.v-input--is-focused {
49
60
  .v-input__slot fieldset {
50
61
  border-color: var(--v-secondary-base);
51
62
  }
63
+
52
64
  input {
53
65
  color: var(--v-secondary-base);
54
66
  }
55
67
  }
68
+
56
69
  &.error--text {
57
70
  .v-input__slot fieldset {
58
71
  border-color: var(--v-error-base);
59
72
  border-width: 1px;
60
73
  }
74
+
61
75
  &:after {
62
76
  content: '\F0028';
63
77
  position: absolute;
@@ -68,28 +82,46 @@
68
82
  }
69
83
  }
70
84
  }
85
+
71
86
  .v-textarea.v-text-field--enclosed .v-text-field__slot {
72
87
  textarea {
73
88
  font-size: 0.75rem;
74
89
  line-height: 1.25rem;
75
90
  }
76
91
  }
77
- .v-text-field--outlined:not(.v-input--is-focused):not(.v-input--has-state)
78
- > .v-input__control
79
- > .v-input__slot
80
- fieldset {
92
+
93
+ .v-text-field--outlined:not(.v-input--is-focused):not(.v-input--has-state)>.v-input__control>.v-input__slot fieldset {
81
94
  border-color: var(--v-gray-lighten2);
82
95
  }
83
- .v-text-field--outlined.v-input--is-focused > .v-input__control > .v-input__slot fieldset {
96
+
97
+ .v-text-field--outlined.v-input--is-focused>.v-input__control>.v-input__slot fieldset {
84
98
  border-color: var(--v-gray-lighten2);
85
99
  border-width: 1px;
86
100
  }
101
+
87
102
  .v-text-field .v-text-field__details {
88
103
  padding-left: 0 !important;
89
- min-height: 16px;
104
+ min-height: 16px !important;
105
+ margin-bottom: 0 !important;
106
+ }
107
+ }
108
+
109
+ .v-text-field {
110
+ .v-input__slot {
111
+ margin-bottom: 4px;
112
+ }
113
+
114
+ &.v-text-field--enclosed .v-text-field__details {
115
+ min-height: 16px !important;
116
+ margin-bottom: 4px !important;
117
+ }
118
+
119
+ &.v-text-field--solo .v-input__control {
120
+ min-height: 30px;
90
121
  }
91
122
  }
92
- .v-form {
123
+
124
+ .v-text-field .v-form {
93
125
  .v-col-fieldset-default {
94
126
  margin-bottom: 0;
95
127
  padding-bottom: 0;
@@ -98,57 +130,63 @@
98
130
  color: var(--v-error-base);
99
131
  }
100
132
  }
133
+
101
134
  .row.form__footer-buttons--right {
102
135
  margin: 0;
103
136
  margin-top: 1rem;
104
137
  padding: 0;
105
138
  justify-content: flex-end;
139
+
106
140
  .v-btn {
107
141
  margin-left: 1rem;
108
142
  }
109
143
  }
110
144
  }
145
+
111
146
  .v-form.v-form-importfile {
112
- > .row:first-child {
147
+ >.row:first-child {
113
148
  border-bottom: 1px solid var(--v-gray-lighten2);
114
149
  padding: 1rem;
150
+
115
151
  h3 {
116
152
  font-weight: 700;
117
153
  color: var(--v-secondary-base);
118
154
  }
119
155
  }
120
156
 
121
- > .row:nth-child(2) {
157
+ >.row:nth-child(2) {
122
158
  padding: 1rem;
159
+
123
160
  legend {
124
161
  font-weight: 700;
125
162
  width: 100%;
126
163
  }
127
164
  }
128
165
  }
166
+
129
167
  .v-form.form-custom-disabled {
130
168
  .theme--light {
131
169
  &.v-text-field.v-input--is-disabled .v-input__slot {
132
170
  padding-left: 0;
171
+
133
172
  input,
134
173
  label {
135
174
  color: var(--v-primary-base);
136
175
  font-size: 1rem !important;
137
176
  }
138
177
  }
178
+
139
179
  &.v-text-field.v-input--is-disabled .v-input__slot fieldset {
140
180
  border: none;
141
181
  }
142
182
  }
143
183
  }
144
- .v-text-field.v-text-field--solo .v-input__control {
145
- min-height: 30px;
146
- }
147
184
 
148
185
  .theme--light.v-input--switch {
149
186
  .v-input--switch__thumb {
150
187
  color: #ffffff !important;
151
188
  }
189
+
152
190
  .v-input--switch__track.theme--light {
153
191
  background: #f0643b;
154
192
 
@@ -156,6 +194,7 @@
156
194
  background-color: var(--v-secondary-base);
157
195
  }
158
196
  }
197
+
159
198
  label {
160
199
  font-size: 0.5rem;
161
200
  font-weight: 600;
@@ -168,9 +207,11 @@
168
207
  .v-form {
169
208
  .row.form__footer-buttons--right {
170
209
  justify-content: unset;
210
+
171
211
  .v-btn {
172
212
  margin-left: 0;
173
213
  }
214
+
174
215
  .v-btn:not(:first-child) {
175
216
  margin-top: 1rem;
176
217
  }
@@ -183,11 +224,13 @@
183
224
  .v-icon.v-icon {
184
225
  font-size: 22px;
185
226
  color: var(--farm-neutral-darken);
227
+
186
228
  &.mdi-checkbox-marked,
187
229
  &.mdi-minus-box {
188
230
  color: var(--farm-primary-base);
189
231
  }
190
232
  }
233
+
191
234
  .v-input--selection-controls__ripple {
192
235
  display: none;
193
236
  }
@@ -198,20 +241,24 @@
198
241
  padding: 8px 12px;
199
242
  height: 36px;
200
243
  border-bottom: none;
244
+
201
245
  &:hover {
202
246
  background-color: var(--farm-primary-lighten);
203
247
  }
204
248
  }
249
+
205
250
  .v-list-item .v-list-item__content {
206
251
  padding: 0;
207
252
  }
253
+
208
254
  .v-list-item__title {
209
255
  font-weight: 700;
210
256
  font-size: 12px;
211
257
  color: var(--farm-text-primary);
212
258
  line-height: 12px;
213
259
  }
260
+
214
261
  .v-list-item__action:first-child {
215
262
  margin-right: 16px;
216
263
  }
217
- }
264
+ }