@farm-investimentos/front-mfe-components 7.2.0 → 7.3.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": "7.2.0",
3
+ "version": "7.3.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -22,6 +22,13 @@
22
22
  min-width: 64px;
23
23
  padding: 0 16px;
24
24
 
25
+ @each $size,
26
+ $value in $sizes {
27
+ &#{'.farm-btn[size=' + $size +']'} {
28
+ font-size: $value;
29
+ }
30
+ }
31
+
25
32
 
26
33
  &.farm-btn--disabled {
27
34
  background-color: #DADADA;
@@ -97,9 +104,24 @@
97
104
  .farm-btn__content i.mdi {
98
105
  color: gray;
99
106
  }
107
+ @each $size,
108
+ $value in $sizes {
109
+ &#{'.farm-btn[size=' + $size +']'} {
110
+ font-size: $value;
111
+ }
112
+ }
113
+
114
+ &[size='lg'] {
115
+ width: 48px;
116
+ height: 48px;
117
+ }
118
+ &[size='xl'] {
119
+ width: 64px;
120
+ height: 64px;
121
+ }
100
122
 
101
123
  @each $color in $colors {
102
- &#{'.farm-btn--' + $color} {
124
+ &#{'.farm-btn--' + $color}:not(.farm-btn--disabled) {
103
125
  &:hover {
104
126
  color: var(--v-#{$color}-base);
105
127
  }
@@ -133,12 +155,12 @@
133
155
  }
134
156
  }
135
157
 
136
- :not(.farm-btn--disabled){
158
+ :not(.farm-btn--disabled) {
137
159
  &.farm-btn--outlined#{'.farm-btn--' + $color} {
138
160
  border: 1px solid var(--v-#{$color}-base);
139
161
  background: white;
140
162
  color: var(--v-#{$color}-base);
141
-
163
+
142
164
  .farm-btn__content i.mdi {
143
165
  color: var(--v-#{$color}-base);
144
166
  }
@@ -148,14 +170,14 @@
148
170
  border: none;
149
171
  background: white;
150
172
  color: var(--v-#{$color}-base);
151
-
173
+
152
174
  .farm-btn__content i.mdi {
153
175
  color: var(--v-#{$color}-base);
154
176
  }
155
177
  }
156
178
  }
157
179
 
158
-
180
+
159
181
  }
160
182
 
161
183
  .farm-btn--elevated {
@@ -6,6 +6,7 @@
6
6
  :disabled="disabled"
7
7
  :type="type"
8
8
  :class="classes"
9
+ :size="$props.size"
9
10
  >
10
11
  <span class="farm-btn__content">
11
12
  <slot></slot>
@@ -18,19 +19,39 @@
18
19
  </router-link>
19
20
  </template>
20
21
  <script lang="ts">
21
- import Vue from 'vue';
22
+ import Vue, { PropType } from 'vue';
22
23
 
23
24
  export default Vue.extend({
24
25
  name: 'farm-btn',
25
26
  inheritAttrs: true,
26
27
 
27
28
  props: {
28
- color: { type: String, default: 'primary' },
29
- outlined: Boolean,
30
- plain: Boolean,
31
- disabled: Boolean,
32
- rounded: Boolean,
33
- icon: Boolean,
29
+ /**
30
+ * Color
31
+ */
32
+ color: {
33
+ type: String as PropType<
34
+ | 'primary'
35
+ | 'secondary'
36
+ | 'error'
37
+ | 'extra'
38
+ | 'accent'
39
+ | 'info'
40
+ | 'success'
41
+ | 'gray'
42
+ | 'yellow'
43
+ | 'white'
44
+ >,
45
+ default: 'primary',
46
+ },
47
+ /**
48
+ * Outlined
49
+ */
50
+ outlined: { type: Boolean, default: false },
51
+ plain: { type: Boolean, default: false },
52
+ disabled: { type: Boolean, default: false },
53
+ rounded: { type: Boolean, default: false },
54
+ icon: { type: Boolean, default: false },
34
55
  type: {
35
56
  type: String,
36
57
  default: 'button',
@@ -39,6 +60,12 @@ export default Vue.extend({
39
60
  type: String,
40
61
  default: null,
41
62
  },
63
+ size: {
64
+ type: String as PropType<
65
+ 'xs' | 'sm' | 'md' | 'lg' | 'xl'
66
+ >,
67
+ default: 'default',
68
+ },
42
69
  },
43
70
 
44
71
  computed: {
@@ -27,7 +27,7 @@ section {
27
27
 
28
28
  .selectfile-container {
29
29
  text-align: center;
30
- .v-icon {
30
+ .farm-icon {
31
31
  font-size: 2.25rem;
32
32
  margin-bottom: 1rem;
33
33
  }
@@ -46,7 +46,7 @@ section {
46
46
  margin-bottom: 0;
47
47
  font-size: 0.75rem;
48
48
  }
49
- .v-btn {
49
+ .farm-btn {
50
50
  margin-top: 1rem;
51
51
  }
52
52
  }
@@ -12,7 +12,7 @@ export const Primary = () => ({
12
12
 
13
13
  export const MaxFileSize = () => ({
14
14
  components: { FilePicker },
15
- template: '<FilePicker maxFileSize="5" />',
15
+ template: '<FilePicker maxFileSize="0.1" />',
16
16
  });
17
17
 
18
18
  Primary.storyName = 'Básico';
@@ -7,28 +7,37 @@
7
7
  :accept="acceptedFileTypes"
8
8
  />
9
9
  <div v-if="!selectedFile" class="selectfile-container">
10
- <v-icon color="secondary">mdi-cloud-upload</v-icon>
10
+ <farm-icon color="secondary">cloud-upload</farm-icon>
11
11
  <p>Clique para selecionar ou arraste o arquivo aqui</p>
12
12
  </div>
13
13
  <div v-if="selectedFile || maxSizeReach" class="reset-container">
14
14
  <div v-if="selectedFile">
15
- <v-icon>mdi-file</v-icon> Arquivo selecionado: {{ selectedFile.name }} ({{
15
+ <farm-icon>file</farm-icon> Arquivo selecionado: {{ selectedFile.name }} ({{
16
16
  Math.floor(selectedFile.size / 1024)
17
17
  }}kB)
18
18
  </div>
19
19
 
20
20
  <p v-if="maxSizeReach" v-html="maxSizeReachMsg"></p>
21
21
 
22
- <farm-btn depressed outlined color="secondary" class="farm-btn--responsive" @click="reset">
22
+ <farm-btn
23
+ outlined
24
+ color="secondary"
25
+ class="farm-btn--responsive"
26
+ title="Escolher outro"
27
+ @click="reset"
28
+ >
23
29
  Escolher outro
24
30
  </farm-btn>
25
31
  </div>
26
32
  </section>
27
33
  </template>
28
- <script>
34
+ <script lang="ts">
35
+ import Vue from 'vue';
29
36
  import DefaultButton from '../Buttons/DefaultButton';
30
- import { VIcon } from 'vuetify/lib/components/VIcon';
31
- export default {
37
+ import Icon from '../Icon';
38
+
39
+ export default Vue.extend({
40
+ name: 'farm-filepicker',
32
41
  props: {
33
42
  /*
34
43
  * Accepted file types
@@ -37,9 +46,9 @@ export default {
37
46
  type: String,
38
47
  default: '*',
39
48
  },
40
- /**
41
- * Max file size (in MB)
42
- */
49
+ /**
50
+ * Max file size (in MB)
51
+ */
43
52
  maxFileSize: {
44
53
  default: null,
45
54
  },
@@ -54,7 +63,7 @@ export default {
54
63
  computed: {
55
64
  maxSizeReachMsg() {
56
65
  return `Arquivo ultrapassou o tamanho máximo de ${this.maxFileSize}MB`;
57
- }
66
+ },
58
67
  },
59
68
  mounted() {
60
69
  this.dropArea = this.$refs.container;
@@ -64,10 +73,10 @@ export default {
64
73
  reset() {
65
74
  this.$refs.container.querySelector('input').value = '';
66
75
  this.$emit('onReset');
67
- this.maxSizeReach = false;
76
+ this.maxSizeReach = false;
68
77
  this.selectedFile = null;
69
78
  },
70
- fileChange(fileList) {
79
+ fileChange(fileList: Array<File>) {
71
80
  this.maxSizeReach = false;
72
81
  if (!fileList.length || fileList.length > 1) return;
73
82
 
@@ -97,9 +106,9 @@ export default {
97
106
  },
98
107
  components: {
99
108
  'farm-btn': DefaultButton,
100
- VIcon,
109
+ 'farm-icon': Icon,
101
110
  },
102
- };
111
+ });
103
112
  </script>
104
113
  <style scoped lang="scss">
105
114
  @import './FilePicker.scss';
@@ -9,16 +9,17 @@
9
9
  line-height: 1;
10
10
  position: relative;
11
11
  text-indent: 0;
12
+
12
13
  @each $color in $colors {
13
14
  &#{'.farm-icon--' + $color} {
14
15
  color: var(--v-#{$color}-base);
15
16
  }
16
17
  }
17
18
 
18
- @each $size, $value in $sizes {
19
+ @each $size,
20
+ $value in $sizes {
19
21
  &#{'.farm-icon[size=' + $size +']'} {
20
- font-size: $value;
22
+ font-size: $value;
21
23
  }
22
-
23
24
  }
24
25
  }
@@ -1,5 +1,5 @@
1
1
  import { withDesign } from 'storybook-addon-designs';
2
- import { DefaultButton } from '../main';
2
+ import { DefaultButton, Icon } from '../../main';
3
3
  import('./Buttons.stories.scss');
4
4
 
5
5
  export default {
@@ -27,7 +27,7 @@ export const ActiveButtons = () => ({
27
27
  };
28
28
  },
29
29
  template: `<div class="buttons-container">
30
- <farm-btn v-for="color of colors":key="color" :color="color">
30
+ <farm-btn v-for="color of colors":key="'random_9_' + color" :color="color">
31
31
  {{ color }}
32
32
  </farm-btn>
33
33
  </div>`,
@@ -44,7 +44,7 @@ export const OutlinedButtons = () => ({
44
44
  },
45
45
  template: `<div class="buttons-container">
46
46
  <h4>Outlined</h4>
47
- <farm-btn v-for="color of colors":key="color" :color="color" outlined>
47
+ <farm-btn v-for="color of colors":key="'random_8_' + color" :color="color" outlined>
48
48
  {{ color }}
49
49
  </farm-btn>
50
50
  </div>`,
@@ -62,15 +62,15 @@ export const DisabledButtons = () => ({
62
62
  },
63
63
  template: `<div class="buttons-container">
64
64
  <h4>Default</h4>
65
- <farm-btn v-for="color of colors":key="color" :color="color" disabled>
65
+ <farm-btn v-for="color of colors":key="'random_5_' + color" :color="color" disabled>
66
66
  {{ color }}
67
67
  </farm-btn>
68
68
  <h4>Outlined</h4>
69
- <farm-btn v-for="color of colors":key="color" :color="color" outlined disabled>
69
+ <farm-btn v-for="color of colors":key="'random_6_' + color" :color="color" outlined disabled>
70
70
  {{ color }}
71
71
  </farm-btn>
72
72
  <h4>Plain</h4>
73
- <farm-btn v-for="color of colors":key="color" :color="color" plain disabled>
73
+ <farm-btn v-for="color of colors":key="'random_7_' + color" :color="color" plain disabled>
74
74
  {{ color }}
75
75
  </farm-btn>
76
76
  </div>`,
@@ -86,7 +86,7 @@ export const Plain = () => ({
86
86
  };
87
87
  },
88
88
  template: `<div class="buttons-container">
89
- <farm-btn v-for="color of colors":key="color" :color="color" plain>
89
+ <farm-btn v-for="color of colors":key="'random_4_' + color" :color="color" plain>
90
90
  {{ color }}
91
91
  </farm-btn>
92
92
  </div>`,
@@ -103,7 +103,7 @@ export const Icons = () => ({
103
103
  },
104
104
  template: `<div class="buttons-container">
105
105
  <h4>Full</h4>
106
- <farm-btn v-for="color of colors":key="color" :color="color">
106
+ <farm-btn v-for="color of colors":key="'random_3_' + color" :color="color">
107
107
  <v-icon>mdi-book</v-icon> book
108
108
  </farm-btn>
109
109
 
@@ -123,6 +123,7 @@ export const Icons = () => ({
123
123
  export const Iconed = () => ({
124
124
  components: {
125
125
  'farm-btn': DefaultButton,
126
+ 'farm-icon': Icon,
126
127
  },
127
128
  data() {
128
129
  return {
@@ -131,9 +132,15 @@ export const Iconed = () => ({
131
132
  },
132
133
  template: `<div class="buttons-container">
133
134
  <h4>Icon</h4>
134
- <farm-btn icon v-for="color of colors" :key="color" :color="color">
135
- <v-icon>mdi-book</v-icon>
135
+ <farm-btn icon v-for="color of colors" :key="'random_2_' + color" :color="color">
136
+ <farm-icon>book</farm-icon>
136
137
  </farm-btn>
138
+
139
+ <h4>Disabled Icon</h4>
140
+ <farm-btn icon v-for="color of colors" :key="'disabled_random_2_' + color" :color="color" :disabled="true">
141
+ <farm-icon>book</farm-icon>
142
+ </farm-btn>
143
+
137
144
  </div>`,
138
145
  });
139
146
 
@@ -148,11 +155,62 @@ export const Rounded = () => ({
148
155
  },
149
156
  template: `<div class="buttons-container">
150
157
  <h4>Rounded</h4>
151
- <farm-btn v-for="color of colors" :key="color" :color="color" rounded >rounded
158
+ <farm-btn v-for="color of colors" :key="'random_1_' + color" :color="color" rounded >rounded
152
159
  </farm-btn>
153
160
  </div>`,
154
161
  });
155
162
 
163
+ export const Sizes = () => ({
164
+ components: {
165
+ 'farm-btn': DefaultButton,
166
+ 'farm-icon': Icon,
167
+ },
168
+ data() {
169
+ return {
170
+ sizes: ['xs', 'sm', 'md', 'lg', 'xl'],
171
+ styles: {
172
+ display: 'flex',
173
+ flexDirection: 'row',
174
+ farmBtn: {
175
+ marginRight: '12px',
176
+ },
177
+ },
178
+ };
179
+ },
180
+ template: `<div>
181
+ <h4>Default</h4>
182
+ <div :style="styles">
183
+ <farm-btn v-for="size of sizes" :style="styles.farmBtn" :key="'default_' + size" :size="size" color="secondary">
184
+ {{ size }}
185
+ </farm-btn>
186
+ </div>
187
+ <h4>Outlined</h4>
188
+ <div :style="styles">
189
+ <farm-btn v-for="size of sizes" :style="styles.farmBtn" :key="'outlined_' + size" :size="size" color="secondary" outlined>
190
+ {{ size }}
191
+ </farm-btn>
192
+ </div>
193
+ <h4>Plain</h4>
194
+ <div :style="styles">
195
+ <farm-btn v-for="size of sizes" :style="styles.farmBtn" :key="'plain_' + size" :size="size" color="secondary" plain>
196
+ {{ size }}
197
+ </farm-btn>
198
+ </div>
199
+ <h4>Rounded</h4>
200
+ <div :style="styles">
201
+ <farm-btn v-for="size of sizes" :style="styles.farmBtn" :key="'rouned_' + size" :size="size" color="secondary" rounded>
202
+ {{ size }}
203
+ </farm-btn>
204
+ </div>
205
+ <h4>Icon</h4>
206
+ <div :style="styles">
207
+ <farm-btn v-for="size of sizes" :style="styles.farmBtn" :key="'icon_' + size" color="secondary" :size="size" icon>
208
+ <farm-icon :size="size">book</farm-icon>
209
+ </farm-btn>
210
+ </div>
211
+ </div>`,
212
+ });
213
+
156
214
  ActiveButtons.story = {
157
215
  name: 'Active',
158
216
  };
@@ -171,3 +229,6 @@ Icons.story = {
171
229
  Rounded.story = {
172
230
  name: 'Rounded',
173
231
  };
232
+ Sizes.story = {
233
+ name: 'Sizes',
234
+ };