@farm-investimentos/front-mfe-components 6.2.6 → 6.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": "6.2.6",
3
+ "version": "6.3.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -56,4 +56,3 @@ HtmlMarkup.storyName = 'Html Markup';
56
56
  Props.storyName = 'Props';
57
57
  Listener.storyName = 'Listener';
58
58
  Iconed.storyName = 'Icon';
59
- To.storyName = 'Teste rota';
@@ -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,10 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
99
103
  &:hover {
100
104
  color: var(--v-#{$color}-base);
101
105
  }
106
+
107
+ i.mdi {
108
+ color: var(--v-#{$color}-base);
109
+ }
102
110
  }
103
111
  }
104
112
  }
@@ -125,27 +133,29 @@ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow;
125
133
  }
126
134
  }
127
135
 
128
- .farm-btn--outlined#{'.farm-btn--' + $color} {
129
- border: 1px solid var(--v-#{$color}-base);
130
- background: white;
131
- color: var(--v-#{$color}-base);
132
-
133
- .farm-btn__content i.mdi {
136
+ :not(.farm-btn--disabled){
137
+ &.farm-btn--outlined#{'.farm-btn--' + $color} {
138
+ border: 1px solid var(--v-#{$color}-base);
139
+ background: white;
134
140
  color: var(--v-#{$color}-base);
141
+
142
+ .farm-btn__content i.mdi {
143
+ color: var(--v-#{$color}-base);
144
+ }
135
145
  }
136
146
 
137
- }
138
-
139
- .farm-btn--plain#{'.farm-btn--' + $color} {
140
- border: none;
141
- background: white;
142
- color: var(--v-#{$color}-base);
143
-
144
- .farm-btn__content i.mdi {
147
+ &.farm-btn--plain#{'.farm-btn--' + $color} {
148
+ border: none;
149
+ background: white;
145
150
  color: var(--v-#{$color}-base);
151
+
152
+ .farm-btn__content i.mdi {
153
+ color: var(--v-#{$color}-base);
154
+ }
146
155
  }
147
-
148
156
  }
157
+
158
+
149
159
  }
150
160
 
151
161
  .farm-btn--elevated {
@@ -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
  },
@@ -47,4 +47,3 @@ Primary.storyName = 'Básico';
47
47
  HtmlMarkup.storyName = 'Html Markup';
48
48
  Props.storyName = 'Props';
49
49
  Listener.storyName = 'Listener';
50
- To.storyName = 'Teste Rota';
@@ -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,67 @@
1
+ <template>
2
+ <i v-on="$listeners" v-bind="$attrs" :class="classes" :size="$props.size" ref="el" />
3
+ </template>
4
+ <script lang="ts">
5
+ import Vue, { PropType } 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
+ /**
15
+ * Color
16
+ */
17
+ color: {
18
+ type: String as PropType<
19
+ | 'primary'
20
+ | 'secondary'
21
+ | 'error'
22
+ | 'extra'
23
+ | 'accent'
24
+ | 'info'
25
+ | 'success'
26
+ | 'gray'
27
+ | 'yellow'
28
+ | 'white'
29
+ >,
30
+ default: 'primary',
31
+ },
32
+ size: {
33
+ type: String as PropType<
34
+ 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'other (examples: 12px, 3rem)'
35
+ >,
36
+ default: 'default',
37
+ },
38
+ },
39
+
40
+ computed: {
41
+ classes() {
42
+ const obj = {};
43
+ return {
44
+ 'farm-icon': true,
45
+ ['farm-icon--' + this.color]: true,
46
+ mdi: true,
47
+ ['mdi-' + this.icon]: true,
48
+ ...obj,
49
+ };
50
+ },
51
+ icon() {
52
+ if (!this.$slots.default) {
53
+ return '';
54
+ }
55
+ return this.$slots.default[0].text!.trim();
56
+ },
57
+ },
58
+ mounted() {
59
+ if (this.size !== 'default' && !breakPoints.includes(this.size)) {
60
+ this.$el.style.fontSize = this.size;
61
+ }
62
+ },
63
+ });
64
+ </script>
65
+ <style lang="scss" scoped>
66
+ @import 'Icon.scss';
67
+ </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;
@@ -0,0 +1,2 @@
1
+ $colors: primary, secondary, error, extra, accent, info, success, gray, yellow, white;
2
+ $sizes: ("xs": 12px, "sm": 16px , "md": 24px, "lg": 36px, "xl": 40px);
@@ -43,6 +43,7 @@ export const OutlinedButtons = () => ({
43
43
  };
44
44
  },
45
45
  template: `<div class="buttons-container">
46
+ <h4>Outlined</h4>
46
47
  <farm-btn v-for="color of colors":key="color" :color="color" outlined>
47
48
  {{ color }}
48
49
  </farm-btn>
@@ -56,12 +57,21 @@ export const DisabledButtons = () => ({
56
57
  data() {
57
58
  return {
58
59
  colors,
59
- x: 1
60
+ x: 1,
60
61
  };
61
62
  },
62
63
  template: `<div class="buttons-container">
64
+ <h4>Default</h4>
63
65
  <farm-btn v-for="color of colors":key="color" :color="color" disabled>
64
66
  {{ color }}
67
+ </farm-btn>
68
+ <h4>Outlined</h4>
69
+ <farm-btn v-for="color of colors":key="color" :color="color" outlined disabled>
70
+ {{ color }}
71
+ </farm-btn>
72
+ <h4>Plain</h4>
73
+ <farm-btn v-for="color of colors":key="color" :color="color" plain disabled>
74
+ {{ color }}
65
75
  </farm-btn>
66
76
  </div>`,
67
77
  });
@@ -121,11 +131,25 @@ export const Iconed = () => ({
121
131
  },
122
132
  template: `<div class="buttons-container">
123
133
  <h4>Icon</h4>
124
- <farm-btn icon v-for="color of colors":key="color" >
125
- <v-icon :color="color">mdi-book</v-icon>
134
+ <farm-btn icon v-for="color of colors" :key="color" :color="color">
135
+ <v-icon>mdi-book</v-icon>
126
136
  </farm-btn>
137
+ </div>`,
138
+ });
127
139
 
128
-
140
+ export const Rounded = () => ({
141
+ components: {
142
+ 'farm-btn': DefaultButton,
143
+ },
144
+ data() {
145
+ return {
146
+ colors,
147
+ };
148
+ },
149
+ template: `<div class="buttons-container">
150
+ <h4>Rounded</h4>
151
+ <farm-btn v-for="color of colors" :key="color" :color="color" rounded >rounded
152
+ </farm-btn>
129
153
  </div>`,
130
154
  });
131
155
 
@@ -144,6 +168,6 @@ Plain.story = {
144
168
  Icons.story = {
145
169
  name: 'Icons',
146
170
  };
147
- Iconed.story = {
148
- name: 'Iconed',
171
+ Rounded.story = {
172
+ name: 'Rounded',
149
173
  };
@@ -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';