@farm-investimentos/front-mfe-components 6.2.4 → 6.3.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.
Files changed (28) hide show
  1. package/dist/front-mfe-components.common.js +2104 -1330
  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 +2104 -1330
  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/Buttons/DefaultButton/DefaultButton.scss +10 -3
  10. package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +1 -1
  11. package/src/components/Buttons/DefaultButton/DefaultButton.vue +17 -1
  12. package/src/components/Buttons/ExportButton/ExportButton.vue +2 -2
  13. package/src/components/Buttons/ImportButton/ImportButton.vue +1 -1
  14. package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +2 -2
  15. package/src/components/Buttons/RemoveButton/RemoveButton.vue +2 -2
  16. package/src/components/Buttons/ToggleButton/ToggleButton.vue +1 -1
  17. package/src/components/FilePicker/FilePicker.vue +1 -1
  18. package/src/components/Icon/Icon.scss +17 -0
  19. package/src/components/Icon/Icon.stories.js +27 -0
  20. package/src/components/Icon/Icon.vue +45 -0
  21. package/src/components/Icon/__tests__/Icon.spec.js +22 -0
  22. package/src/components/Icon/index.ts +4 -0
  23. package/src/components/MainFilter/MainFilter.vue +1 -1
  24. package/src/configurations/_variables.scss +2 -0
  25. package/src/examples/Buttons.stories.js +21 -6
  26. package/src/examples/Icon.stories.js +78 -0
  27. package/src/examples/Icons.stories.scss +14 -0
  28. 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": "6.2.4",
3
+ "version": "6.3.0",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -1,4 +1,4 @@
1
- $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
1
+ @import '../../../configurations/variables';
2
2
 
3
3
  .farm-btn {
4
4
  font-size: 0.75rem;
@@ -76,6 +76,10 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
76
76
  }
77
77
  }
78
78
  }
79
+
80
+ &.farm-btn--rounded {
81
+ border-radius: 1rem;
82
+ }
79
83
  }
80
84
 
81
85
  .farm-btn--round {
@@ -99,6 +103,9 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
99
103
  &:hover {
100
104
  color: var(--v-#{$color}-base);
101
105
  }
106
+ i.mdi {
107
+ color: var(--v-#{$color}-base);
108
+ }
102
109
  }
103
110
  }
104
111
  }
@@ -109,7 +116,7 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
109
116
  flex-direction: row;
110
117
  align-items: center;
111
118
 
112
- i.mdi {
119
+ ::v-deep i.mdi {
113
120
  font-size: 1rem;
114
121
  }
115
122
  }
@@ -120,7 +127,7 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
120
127
  background-color: var(--v-#{$color}-base);
121
128
  color: white;
122
129
 
123
- .farm-btn__content i.mdi {
130
+ ::v-deep .farm-btn__content i.mdi {
124
131
  color: white;
125
132
  }
126
133
  }
@@ -6,7 +6,7 @@ export default {
6
6
  parameters: {
7
7
  docs: {
8
8
  description: {
9
- component: `Default button (inherit from Vuetify)<br />
9
+ component: `Default button<br />
10
10
  selector: <em>farm-btn</em>
11
11
  `,
12
12
  },
@@ -1,9 +1,21 @@
1
1
  <template>
2
- <button v-on="$listeners" v-bind="$attrs" :type="type" :class="classes">
2
+ <button
3
+ v-if="!to"
4
+ v-on="$listeners"
5
+ v-bind="$attrs"
6
+ :disabled="disabled"
7
+ :type="type"
8
+ :class="classes"
9
+ >
3
10
  <span class="farm-btn__content">
4
11
  <slot></slot>
5
12
  </span>
6
13
  </button>
14
+ <router-link :to="to" v-bind="$attrs" :disabled="disabled" :class="classes" v-else>
15
+ <span class="farm-btn__content">
16
+ <slot></slot>
17
+ </span>
18
+ </router-link>
7
19
  </template>
8
20
  <script lang="ts">
9
21
  import Vue from 'vue';
@@ -23,6 +35,10 @@ export default Vue.extend({
23
35
  type: String,
24
36
  default: 'button',
25
37
  },
38
+ to: {
39
+ type: String,
40
+ default: null,
41
+ },
26
42
  },
27
43
 
28
44
  computed: {
@@ -3,7 +3,7 @@
3
3
  v-if="optionsList.length == 0"
4
4
  @click="onClick"
5
5
  dense
6
- class="v-btn--responsive"
6
+ class="farm-btn--responsive"
7
7
  outlined
8
8
  title="Exportar"
9
9
  :disabled="disabled"
@@ -23,7 +23,7 @@
23
23
  v-bind="attrs"
24
24
  v-on="on"
25
25
  dense
26
- class="v-btn--responsive"
26
+ class="farm-btn--responsive"
27
27
  outlined
28
28
  title="Exportar"
29
29
  @onClick="togglePopover = true"
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <farm-btn @click="onClick" dense class="v-btn--responsive farm-btn--import" outlined title="Importar">
2
+ <farm-btn @click="onClick" dense class="farm-btn--responsive farm-btn--import" outlined title="Importar">
3
3
  <i class="mdi mdi-upload"></i>
4
4
  {{ label }}
5
5
  </farm-btn>
@@ -5,10 +5,10 @@
5
5
  v-bind="attrs"
6
6
  v-on="on"
7
7
  dense
8
- @onClick="togglePopover = true"
9
- class="v-btn--responsive farm-btn--import"
8
+ class="farm-btn--responsive farm-btn--import"
10
9
  outlined
11
10
  title="Importar"
11
+ @onClick="togglePopover = true"
12
12
  >
13
13
  Importar
14
14
  <i
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <farm-btn
3
- @click="onClick"
4
3
  dense
5
- class="v-btn--responsive"
4
+ class="farm-btn--responsive"
6
5
  color="error"
7
6
  :title="label"
8
7
  :disabled="disabled"
8
+ @click="onClick"
9
9
  >
10
10
  <v-icon>mdi-trash-can-outline</v-icon>
11
11
  {{ label }}
@@ -2,7 +2,7 @@
2
2
  <farm-btn
3
3
  @click="onClick"
4
4
  dense
5
- class="v-btn--responsive"
5
+ class="farm-btn--responsive"
6
6
  :class="{
7
7
  'v-btn_icon--prepend': prepend,
8
8
  'v-btn_icon--apppend': !prepend,
@@ -19,7 +19,7 @@
19
19
 
20
20
  <p v-if="maxSizeReach" v-html="maxSizeReachMsg"></p>
21
21
 
22
- <farm-btn depressed outlined color="secondary" class="v-btn-responsive" @click="reset">
22
+ <farm-btn depressed outlined color="secondary" class="farm-btn--responsive" @click="reset">
23
23
  Escolher outro
24
24
  </farm-btn>
25
25
  </div>
@@ -0,0 +1,17 @@
1
+ @import '../../configurations/variables';
2
+
3
+ .farm-icon {
4
+ font-size: 24px;
5
+ @each $color in $colors {
6
+ &#{'.farm-icon--' + $color} {
7
+ color: var(--v-#{$color}-base);
8
+ }
9
+ }
10
+
11
+ @each $size, $value in $sizes {
12
+ &#{'.farm-icon[size=' + $size +']'} {
13
+ font-size: $value;
14
+ }
15
+
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ import Icon from './Icon.vue';
2
+
3
+ export default {
4
+ title: 'API/Icon',
5
+ component: Icon,
6
+ parameters: {
7
+ docs: {
8
+ description: {
9
+ component: `Icon<br />
10
+ selector: <em>farm-icon</em>
11
+ `,
12
+ },
13
+ },
14
+ viewMode: 'docs',
15
+ },
16
+ };
17
+
18
+
19
+
20
+ export const Primary = () => ({
21
+ components: { 'farm-icon': Icon },
22
+ template: '<farm-icon color="secondary">book</farm-icon>',
23
+ });
24
+
25
+
26
+
27
+ Primary.storyName = 'Primary';
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <i v-on="$listeners" v-bind="$attrs" :class="classes" ref="el"> </i>
3
+ </template>
4
+ <script lang="ts">
5
+ import Vue from 'vue';
6
+
7
+ const breakPoints = ['xs', 'sm', 'md', 'lg', 'xl'];
8
+
9
+ export default Vue.extend({
10
+ name: 'farm-icon',
11
+ inheritAttrs: true,
12
+
13
+ props: {
14
+ color: { type: String, default: 'primary' },
15
+ size: { type: String, default: 'default' },
16
+ },
17
+
18
+ computed: {
19
+ classes() {
20
+ const obj = {};
21
+ return {
22
+ 'farm-icon': true,
23
+ ['farm-icon--' + this.color]: true,
24
+ mdi: true,
25
+ ['mdi-' + this.icon]: true,
26
+ ...obj,
27
+ };
28
+ },
29
+ icon() {
30
+ if (!this.$slots.default) {
31
+ return '';
32
+ }
33
+ return this.$slots.default[0].text!.trim();
34
+ },
35
+ },
36
+ mounted() {
37
+ if (this.size !== 'default' && !breakPoints.includes(this.size)) {
38
+ this.$el.style.fontSize = this.size;
39
+ }
40
+ },
41
+ });
42
+ </script>
43
+ <style lang="scss" scoped>
44
+ @import 'Icon.scss';
45
+ </style>
@@ -0,0 +1,22 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Icon from '../Icon';
3
+
4
+ describe('Icon component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(Icon);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+
17
+ describe('computed properties', () => {
18
+ it('get classes', () => {
19
+ expect(component.classes).toBeDefined();
20
+ });
21
+ });
22
+ });
@@ -0,0 +1,4 @@
1
+ import Icon from './Icon.vue';
2
+
3
+ export { Icon };
4
+ export default Icon;
@@ -17,7 +17,7 @@
17
17
  <DefaultButton
18
18
  v-if="hasExtraFilters"
19
19
  color="secondary"
20
- class="v-btn--responsive mt-14 mt-sm-8"
20
+ class="farm-btn--responsive mt-14 mt-sm-8"
21
21
  @click="onFilterClick"
22
22
  >
23
23
  <v-icon color="white" class="mr-2" small>{{ extraFiltersBtnIcon }}</v-icon>
@@ -0,0 +1,2 @@
1
+ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
2
+ $sizes: ("xs": 12px, "sm": 16px , "md": 24px, "lg": 36px, "xl": 40px);
@@ -43,7 +43,7 @@ export const OutlinedButtons = () => ({
43
43
  };
44
44
  },
45
45
  template: `<div class="buttons-container">
46
- <farm-btn v-for="color of colors":key="color" :color="color"outlined>
46
+ <farm-btn v-for="color of colors":key="color" :color="color" outlined>
47
47
  {{ color }}
48
48
  </farm-btn>
49
49
  </div>`,
@@ -56,6 +56,7 @@ export const DisabledButtons = () => ({
56
56
  data() {
57
57
  return {
58
58
  colors,
59
+ x: 1,
59
60
  };
60
61
  },
61
62
  template: `<div class="buttons-container">
@@ -120,11 +121,25 @@ export const Iconed = () => ({
120
121
  },
121
122
  template: `<div class="buttons-container">
122
123
  <h4>Icon</h4>
123
- <farm-btn icon v-for="color of colors":key="color" >
124
- <v-icon :color="color">mdi-book</v-icon>
124
+ <farm-btn icon v-for="color of colors" :key="color" :color="color">
125
+ <v-icon>mdi-book</v-icon>
125
126
  </farm-btn>
127
+ </div>`,
128
+ });
126
129
 
127
-
130
+ export const Rounded = () => ({
131
+ components: {
132
+ 'farm-btn': DefaultButton,
133
+ },
134
+ data() {
135
+ return {
136
+ colors,
137
+ };
138
+ },
139
+ template: `<div class="buttons-container">
140
+ <h4>Rounded</h4>
141
+ <farm-btn v-for="color of colors" :key="color" :color="color" rounded >rounded
142
+ </farm-btn>
128
143
  </div>`,
129
144
  });
130
145
 
@@ -143,6 +158,6 @@ Plain.story = {
143
158
  Icons.story = {
144
159
  name: 'Icons',
145
160
  };
146
- Iconed.story = {
147
- name: 'Iconed',
161
+ Rounded.story = {
162
+ name: 'Rounded',
148
163
  };
@@ -0,0 +1,78 @@
1
+ import { withDesign } from 'storybook-addon-designs';
2
+ import { Icon } from '../main';
3
+ import('./Icons.stories.scss');
4
+
5
+ export default {
6
+ title: 'Examples/Icon',
7
+ decorators: [withDesign],
8
+ parameters: {
9
+ viewMode: 'docs',
10
+ docs: {
11
+ description: {
12
+ component: `Icon`,
13
+ },
14
+ },
15
+ },
16
+ };
17
+
18
+ const colors = ['primary', 'secondary', 'error', 'gray', 'accent', 'yellow'];
19
+
20
+ export const Icons = () => ({
21
+ components: {
22
+ 'farm-icon': Icon,
23
+ },
24
+ data() {
25
+ return {
26
+ colors,
27
+ };
28
+ },
29
+ template: `<div class="icons-container">
30
+ <farm-icon v-for="color of colors":key="color" :color="color">
31
+ book
32
+ </farm-icon>
33
+ </div>`,
34
+ });
35
+
36
+ export const Sizes = () => ({
37
+ components: {
38
+ 'farm-icon': Icon,
39
+ },
40
+ data() {
41
+ return {
42
+ sizes: ['xs', 'sm', 'md', 'lg', 'xl'],
43
+ };
44
+ },
45
+ template: `<div class="icons-container">
46
+ <div v-for="size of sizes">
47
+ <farm-icon :key="size" :size="size">
48
+ book
49
+ </farm-icon>
50
+ {{ size }}
51
+ </div>
52
+ <div>
53
+ <farm-icon size="1.5rem">
54
+ book
55
+ </farm-icon>
56
+ Custom: 1.5rem
57
+ </div>
58
+ <div>
59
+ <farm-icon size="0.5rem">
60
+ book
61
+ </farm-icon>
62
+ Custom: 0.5rem
63
+ </div>
64
+ <div>
65
+ <farm-icon size="14px">
66
+ book
67
+ </farm-icon>
68
+ Custom: 14px
69
+ </div>
70
+ </div>`,
71
+ });
72
+
73
+ Icons.story = {
74
+ name: 'Colors',
75
+ };
76
+ Sizes.story = {
77
+ name: 'Sizes',
78
+ };
@@ -0,0 +1,14 @@
1
+ .icons-container {
2
+ display: flex;
3
+ flex-direction: row;
4
+ > i {
5
+ margin-right: 1rem;
6
+ }
7
+
8
+ > div {
9
+ display: flex;
10
+ flex-direction: column;
11
+ margin-right: 1rem;
12
+ align-items: center;
13
+ }
14
+ }
package/src/main.ts CHANGED
@@ -67,3 +67,4 @@ export * from './components/ChipInviteStatus';
67
67
  export * from './components/Stepper';
68
68
  export * from './components/Logger';
69
69
  export * from './components/Logger/LoggerItem';
70
+ export * from './components/Icon';