@farm-investimentos/front-mfe-components 11.7.3 → 11.8.1

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 (33) hide show
  1. package/dist/front-mfe-components.common.js +701 -300
  2. package/dist/front-mfe-components.common.js.map +1 -1
  3. package/dist/front-mfe-components.css +1 -1
  4. package/dist/front-mfe-components.umd.js +701 -300
  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/AlertBox/AlertBox.scss +45 -0
  10. package/src/components/AlertBox/AlertBox.stories.js +30 -1
  11. package/src/components/AlertBox/AlertBox.vue +66 -9
  12. package/src/components/DialogHeader/DialogHeader.scss +7 -1
  13. package/src/components/DialogHeader/DialogHeader.vue +1 -0
  14. package/src/components/Form/Form.stories.js +35 -1
  15. package/src/components/Icon/Icon.scss +27 -20
  16. package/src/components/Icon/Icon.stories.js +26 -0
  17. package/src/components/Icon/Icon.vue +6 -0
  18. package/src/components/IdCaption/IdCaption.scss +9 -3
  19. package/src/components/IdCaption/IdCaption.stories.js +18 -0
  20. package/src/components/IdCaption/IdCaption.vue +7 -1
  21. package/src/components/Modal/Modal.scss +0 -6
  22. package/src/components/Modal/Modal.vue +1 -1
  23. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +9 -5
  24. package/src/components/Select/Select.scss +18 -0
  25. package/src/components/Select/Select.stories.js +142 -0
  26. package/src/components/Select/Select.vue +229 -0
  27. package/src/components/Select/__tests__/Select.spec.js +40 -0
  28. package/src/components/Select/index.ts +4 -0
  29. package/src/components/TableContextMenu/TableContextMenu.scss +5 -15
  30. package/src/components/TableContextMenu/TableContextMenu.stories.js +11 -2
  31. package/src/components/TableContextMenu/TableContextMenu.vue +19 -3
  32. package/src/components/TextFieldV2/TextFieldV2.stories.js +1 -1
  33. package/src/main.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "11.7.3",
3
+ "version": "11.8.1",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -0,0 +1,45 @@
1
+ @import '../../configurations/theme-colors';
2
+
3
+ .farm-alert-box {
4
+ background-color: themeColor('primary', 'lighten');
5
+ border-radius: 5px;
6
+ color: themeColor('primary', 'darken');
7
+ display: flex;
8
+ padding: 8px 16px;
9
+ position: relative;
10
+ min-height: 40px;
11
+
12
+ &__content {
13
+ flex: 1;
14
+
15
+ &--with-dismissable {
16
+ margin-right: 40px;
17
+ }
18
+ }
19
+
20
+ &__icon {
21
+ align-items: center;
22
+ display: flex;
23
+ margin-right: 16px;
24
+ }
25
+
26
+ &__close {
27
+ position: absolute;
28
+ right: 8px;
29
+ bottom: 50%;
30
+ transform: translateY(50%);
31
+ }
32
+
33
+ &--dense {
34
+ display: inline-flex;
35
+ }
36
+ }
37
+
38
+ .fade-enter-active,
39
+ .fade-leave-active {
40
+ transition: opacity 0.3s;
41
+ }
42
+ .fade-enter,
43
+ .fade-leave-to {
44
+ opacity: 0;
45
+ }
@@ -18,4 +18,33 @@ export default {
18
18
 
19
19
  export const Primary = () => ({
20
20
  template: '<farm-alertbox>alert box</farm-alertbox>',
21
- });
21
+ });
22
+
23
+ export const withIcon = () => ({
24
+ template: '<farm-alertbox icon="book">alert box</farm-alertbox>',
25
+ });
26
+
27
+ export const withDismissable = () => ({
28
+ template: '<farm-alertbox dismissable>alert box</farm-alertbox>',
29
+ });
30
+
31
+ export const dense = () => ({
32
+ template: '<farm-alertbox dismissable dense>alert box</farm-alertbox>',
33
+ });
34
+
35
+ export const full = () => ({
36
+ template: '<farm-alertbox icon="book" dismissable>alert box</farm-alertbox>',
37
+ });
38
+
39
+ export const moreThanOneLine = () => ({
40
+ data() {
41
+ return {
42
+ text: `lorem ipsu lorem ipsu lorem ipsu lorem ipsu
43
+ lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
44
+ lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
45
+ lorem ipsu lorem ipsu lorem ipsu lorem ipsu lorem ipsu
46
+ lorem ipsu lorem ipsu lorem ipsu`,
47
+ };
48
+ },
49
+ template: '<farm-alertbox icon="book" dismissable>{{text}}</farm-alertbox>',
50
+ });
@@ -1,19 +1,76 @@
1
1
  <template>
2
- <div>
3
- <!--
4
- @slot Use this slot for the content
5
- -->
6
- <slot></slot>
7
- </div>
2
+ <transition name="fade">
3
+ <div v-if="visible" :class="{ 'farm-alert-box': true, 'farm-alert-box--dense': dense }">
4
+ <farm-icon
5
+ v-if="icon"
6
+ class="farm-alert-box__icon"
7
+ color="primary"
8
+ variation="darken"
9
+ size="md"
10
+ >{{ icon }}</farm-icon
11
+ >
12
+ <div
13
+ :class="{
14
+ 'farm-alert-box__content': true,
15
+ 'farm-alert-box__content--with-dismissable': dismissable,
16
+ }"
17
+ >
18
+ <farm-bodytext
19
+ :type="1"
20
+ variation="regular"
21
+ color="primary"
22
+ color-variation="darken"
23
+ >
24
+ <slot></slot>
25
+ </farm-bodytext>
26
+ </div>
27
+ <farm-btn class="farm-alert-box__close" v-if="dismissable" icon size="md">
28
+ <farm-icon color="primary" variation="darken" size="md">close</farm-icon>
29
+ </farm-btn>
30
+ </div>
31
+ </transition>
8
32
  </template>
9
33
 
10
34
  <script lang="ts">
11
- import Vue from 'vue';
35
+ import Vue, { ref } from 'vue';
12
36
 
13
37
  export default Vue.extend({
14
38
  name: 'farm-alertbox',
15
- props: {},
16
- setup() {},
39
+ props: {
40
+ /**
41
+ * Left Icon?
42
+ */
43
+ icon: {
44
+ type: String,
45
+ default: null,
46
+ },
47
+ /**
48
+ * Close icon and option to close AlertBox?
49
+ */
50
+ dismissable: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ /**
55
+ * Dense?
56
+ */
57
+ dense: {
58
+ type: Boolean,
59
+ default: false,
60
+ },
61
+ },
62
+ setup() {
63
+ const visible = ref(true);
64
+
65
+ function close() {
66
+ visible.value = false;
67
+ }
68
+
69
+ return {
70
+ visible,
71
+ close,
72
+ };
73
+ },
17
74
  });
18
75
  </script>
19
76
  <style lang="scss" scoped>
@@ -13,7 +13,7 @@
13
13
 
14
14
  header {
15
15
  font-size: 12px;
16
- padding: 16px;
16
+ padding: 6px 16px;
17
17
  background-color: #fff;
18
18
  font-weight: 700;
19
19
  color: var(--farm-primary-base);
@@ -21,4 +21,10 @@ header {
21
21
  display: flex;
22
22
  justify-content: flex-start;
23
23
  align-items: center;
24
+
25
+ >.farm-typography.farm-caption {
26
+ align-items: center;
27
+ width: 100%;
28
+ margin-bottom: 0;
29
+ }
24
30
  }
@@ -10,6 +10,7 @@
10
10
  <farm-btn
11
11
  v-if="hasCloseIcon"
12
12
  icon
13
+ color="secondary"
13
14
  class="farm-dialog-header__close"
14
15
  title="Fechar"
15
16
  @click="onClose"
@@ -296,4 +296,38 @@ export const MigrateTextVieldV2 = () => ({
296
296
  form: {{ form }}
297
297
  </farm-form>
298
298
  `,
299
- });
299
+ });
300
+
301
+ export const MigrateSelectV2 = () => ({
302
+ data() {
303
+ return {
304
+ form: {
305
+ document: '',
306
+ },
307
+ validForm: false,
308
+ rules: {
309
+ required: value => !!value || 'Campo obrigatório',
310
+ },
311
+ items: [
312
+ { value: null, text: '' },
313
+ { value: 1, text: 'label 1' },
314
+ { value: 2, text: 'label 2' },
315
+ ],
316
+ styles,
317
+ };
318
+ },
319
+ template: `
320
+ <farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
321
+ <div>
322
+ <farm-label :required="true">Documento</farm-label>
323
+ <farm-select v-model="form.document" :items="items" :rules="[rules.required]" />
324
+ </div>
325
+
326
+ <div class="footer" :style="[styles.footer]">
327
+ <farm-btn outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
328
+ <farm-btn :disabled="!validForm">Salvar</farm-btn>
329
+ </div>
330
+ form: {{ form }}
331
+ </farm-form>
332
+ `,
333
+ });
@@ -2,25 +2,32 @@
2
2
  @import '../../configurations/theme-colors';
3
3
 
4
4
  .farm-icon {
5
- align-items: center;
6
- display: inline-flex;
7
- font-size: 24px;
8
- justify-content: center;
9
- letter-spacing: normal;
10
- line-height: 1;
11
- position: relative;
12
- text-indent: 0;
5
+ align-items: center;
6
+ display: inline-flex;
7
+ font-size: 24px;
8
+ justify-content: center;
9
+ letter-spacing: normal;
10
+ line-height: 1;
11
+ position: relative;
12
+ text-indent: 0;
13
13
 
14
- @each $color in $theme-colors-list {
15
- &#{'--' + $color} {
16
- color: var(--farm-#{$color}-base);
17
- }
18
- }
14
+ @each $color in $theme-colors-list {
15
+ &#{'--' + $color} {
16
+ color: var(--farm-#{$color}-base);
19
17
 
20
- @each $size,
21
- $value in $sizes {
22
- &#{'.farm-icon[size=' + $size +']'} {
23
- font-size: $value;
24
- }
25
- }
26
- }
18
+ &.farm-icon--lighten {
19
+ color: var(--farm-#{$color}-lighten);
20
+ }
21
+
22
+ &.farm-icon--darken {
23
+ color: var(--farm-#{$color}-darken);
24
+ }
25
+ }
26
+ }
27
+
28
+ @each $size, $value in $sizes {
29
+ &#{'.farm-icon[size=' + $size + ']'} {
30
+ font-size: $value;
31
+ }
32
+ }
33
+ }
@@ -44,6 +44,32 @@ export const Colors = () => ({
44
44
  </div>`,
45
45
  });
46
46
 
47
+ export const ColorsLighten = () => ({
48
+ data() {
49
+ return {
50
+ colors: [...colors],
51
+ };
52
+ },
53
+ template: `<div class="icons-container">
54
+ <farm-icon v-for="color of colors":key="color" :color="color" variation="lighten">
55
+ book
56
+ </farm-icon>
57
+ </div>`,
58
+ });
59
+
60
+ export const ColorsDarken = () => ({
61
+ data() {
62
+ return {
63
+ colors: [...colors],
64
+ };
65
+ },
66
+ template: `<div class="icons-container">
67
+ <farm-icon v-for="color of colors":key="color" :color="color" variation="darken">
68
+ book
69
+ </farm-icon>
70
+ </div>`,
71
+ });
72
+
47
73
  export const Sizes = () => ({
48
74
  data() {
49
75
  return {
@@ -36,6 +36,10 @@ export default Vue.extend({
36
36
  >,
37
37
  default: 'default',
38
38
  },
39
+ variation: {
40
+ type: String as PropType<'lighten' | 'base' | 'darken'>,
41
+ default: 'base',
42
+ },
39
43
  },
40
44
 
41
45
  data() {
@@ -52,6 +56,8 @@ export default Vue.extend({
52
56
  ['farm-icon--' + this.color]: true,
53
57
  mdi: true,
54
58
  ['mdi-' + this.icon]: true,
59
+ 'farm-icon--lighten': this.variation === 'lighten',
60
+ 'farm-icon--darken': this.variation === 'darken',
55
61
  ...obj,
56
62
  };
57
63
  },
@@ -1,6 +1,6 @@
1
1
  .idcaption {
2
2
  display: flex;
3
-
3
+
4
4
  .farm-icon-box {
5
5
  margin-right: 8px;
6
6
  }
@@ -17,11 +17,12 @@
17
17
  }
18
18
 
19
19
  .farm-typography {
20
-
20
+
21
21
  margin-bottom: 0;
22
22
  display: flex;
23
23
  flex: none;
24
- > span {
24
+
25
+ >span {
25
26
  position: relative;
26
27
  }
27
28
  }
@@ -33,4 +34,9 @@
33
34
  top: -8px;
34
35
  }
35
36
  }
37
+
38
+ .farm-btn--clickable {
39
+ position: absolute;
40
+ top: -50%;
41
+ }
36
42
  }
@@ -183,3 +183,21 @@ export const CustomTooltipColor = () => ({
183
183
  </farm-idcaption>
184
184
  `,
185
185
  });
186
+
187
+
188
+ export const Teste = () => ({
189
+ template: `
190
+ <farm-idcaption
191
+ icon="account-box-outline"
192
+ copy-text=""
193
+ :link="true"
194
+ >
195
+ <template v-slot:title>
196
+ Upper Line Text
197
+ </template>
198
+ <template v-slot:subtitle>
199
+ 0
200
+ </template>
201
+ </farm-idcaption>
202
+ `,
203
+ });
@@ -7,7 +7,13 @@
7
7
  <farm-caption variation="medium" v-if="hasTitle">
8
8
  <span>
9
9
  <slot name="title"></slot>
10
- <farm-btn icon color="gray" v-if="link" @click="$emit('onLinkClick')">
10
+ <farm-btn
11
+ v-if="link"
12
+ icon
13
+ color="gray"
14
+ class="farm-btn--clickable"
15
+ @click="$emit('onLinkClick')"
16
+ >
11
17
  <farm-icon size="xs">open-in-new</farm-icon>
12
18
  </farm-btn>
13
19
  </span>
@@ -34,20 +34,14 @@
34
34
 
35
35
  &--content {
36
36
  max-height: calc(100vh - 48px);
37
- //overflow-y: auto;
38
37
  width: 100%;
39
38
  padding: 0;
40
-
41
39
  >div {
42
- //max-height: calc(100vh - 176px);
43
- //max-height: calc(100vh - 64px);
44
40
  overflow-y: auto;
45
41
  padding: 0 16px;
46
42
  }
47
43
  }
48
44
 
49
-
50
-
51
45
  &--header {
52
46
  position: absolute;
53
47
  top: 0;
@@ -5,7 +5,7 @@
5
5
  :class="{ 'farm-modal': true, ['farm-modal--size-' + size]: true }"
6
6
  :style="styleObject"
7
7
  >
8
- <div class="farm-modal--container teste">
8
+ <div class="farm-modal--container">
9
9
  <div class="farm-modal--header">
10
10
  <!-- @slot header -->
11
11
  <slot name="header"></slot>
@@ -195,15 +195,19 @@ export default Vue.extend({
195
195
  this.$emit('onFileChange', newValue);
196
196
  return;
197
197
  }
198
- const invalidTypeArray = newValue.filter(
199
- file =>
198
+ const invalidTypeArray = newValue.filter(file => {
199
+ const type = file.type;
200
+
201
+ return (
200
202
  this.acceptedFileTypes !== '*' &&
201
- this.acceptedFileTypes.indexOf(file.type) === -1
202
- );
203
+ (this.acceptedFileTypes.indexOf(file.type) === -1 || !type)
204
+ );
205
+ });
203
206
 
204
207
  if (invalidTypeArray.length > 0) {
205
208
  const validTypeArray = newValue.filter(file => {
206
- if (this.acceptedFileTypes.indexOf(file.type) === -1) {
209
+ const type = file.type;
210
+ if (this.acceptedFileTypes.indexOf(file.type) === -1 || !type) {
207
211
  return false;
208
212
  }
209
213
  return true;
@@ -0,0 +1,18 @@
1
+ @import '../TextFieldV2/TextFieldV2.scss';
2
+
3
+ .farm-listitem--selected {
4
+ background-color: var(--farm-neutral-lighten);
5
+ }
6
+
7
+ .farm-contextmenu {
8
+ width: 100%;
9
+ }
10
+
11
+ .farm-icon {
12
+ transition: all ease 0.3s;
13
+ cursor: pointer;
14
+
15
+ &--rotate {
16
+ transform: rotate(180deg);
17
+ }
18
+ }
@@ -0,0 +1,142 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import Select from './Select.vue';
3
+
4
+ export default {
5
+ title: 'Form/SelectV2',
6
+ component: Select,
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `Select<br />
12
+ selector: <em>farm-select</em><br />
13
+ <span style="color: var(--farm-extra-1-base);">development</span>
14
+ `,
15
+ },
16
+ },
17
+ design: {
18
+ type: 'figma',
19
+ url: 'https://www.figma.com/file/jnZXo2e0nRJ3fVXl4Et8t4/%E2%9C%8D-Design-System-%7C-BACKUP-(10%2F10%2F2022)?node-id=2491%3A4487',
20
+ },
21
+ viewMode: 'docs',
22
+ },
23
+ };
24
+
25
+ export const Primary = () => ({
26
+ data() {
27
+ return {
28
+ v: null,
29
+ items: [
30
+ { value: 1, text: ' value 1' },
31
+ { value: 2, text: ' value 2' },
32
+ { value: 3, text: ' value 3' },
33
+ ],
34
+ };
35
+ },
36
+ template: `<div style="width: 480px">
37
+ <farm-select v-model="v" :items="items" />
38
+ v-model: {{ v }}
39
+ </div>`,
40
+ });
41
+
42
+ export const InitialValue = () => ({
43
+ data() {
44
+ return {
45
+ v: 1,
46
+ items: [
47
+ { value: 1, text: ' value 1' },
48
+ { value: 2, text: ' value 2' },
49
+ { value: 3, text: ' value 3' },
50
+ ],
51
+ };
52
+ },
53
+ template: `<div style="width: 480px">
54
+ <farm-select v-model="v" :items="items" />
55
+ v-model: {{ v }}
56
+ </div>`,
57
+ });
58
+
59
+ export const Readonly = () => ({
60
+ data() {
61
+ return {
62
+ v: 1,
63
+ items: [
64
+ { value: 1, text: ' value 1' },
65
+ { value: 2, text: ' value 2' },
66
+ { value: 3, text: ' value 3' },
67
+ ],
68
+ };
69
+ },
70
+ template: `<div style="width: 480px">
71
+ <farm-select v-model="v" :items="items" readonly />
72
+ v-model: {{ v }}
73
+ </div>`,
74
+ });
75
+
76
+ export const Disabled = () => ({
77
+ data() {
78
+ return {
79
+ v: 1,
80
+ items: [
81
+ { value: 1, text: ' value 1' },
82
+ { value: 2, text: ' value 2' },
83
+ { value: 3, text: ' value 3' },
84
+ ],
85
+ };
86
+ },
87
+ template: `<div style="width: 480px">
88
+ <farm-select v-model="v" :items="items" disabled />
89
+ v-model: {{ v }}
90
+ </div>`,
91
+ });
92
+
93
+ export const Validate = () => ({
94
+ data() {
95
+ return {
96
+ v: null,
97
+ items: [
98
+ { value: null, text: '' },
99
+ { value: 1, text: ' value 1' },
100
+ { value: 2, text: ' value 2' },
101
+ { value: 3, text: ' value 3' },
102
+ ],
103
+ rules: {
104
+ required: value => !!value || 'Required field',
105
+ },
106
+ };
107
+ },
108
+ template: `<div style="width: 480px">
109
+ <farm-label required>Required</farm-label>
110
+ <farm-select v-model="v" :items="items" :rules="[rules.required]" />
111
+ v-model: {{ v }}
112
+ </div>`,
113
+ });
114
+
115
+
116
+ export const Reset = () => ({
117
+ data() {
118
+ return {
119
+ v: 1,
120
+ items: [
121
+ { value: 1, text: ' value 1' },
122
+ { value: 2, text: ' value 2' },
123
+ { value: 3, text: ' value 3' },
124
+ ],
125
+ rules: {
126
+ required: value => !!value || 'Required field',
127
+ },
128
+ };
129
+ },
130
+ methods: {
131
+ click() {
132
+ this.$refs.select.reset();
133
+ }
134
+ },
135
+ template: `<div style="width: 480px">
136
+ <farm-select v-model="v" :items="items" ref="select" :rules="[rules.required]" />
137
+ v-model: {{ v }}
138
+ <farm-btn @click="click">
139
+ reset
140
+ </farm-btn>
141
+ </div>`,
142
+ });