@farm-investimentos/front-mfe-components 11.4.0 → 11.4.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/dist/front-mfe-components.common.js +210 -155
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +210 -155
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Buttons/DefaultButton/DefaultButton.scss +14 -2
- package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +40 -6
- package/src/components/Buttons/DefaultButton/DefaultButton.vue +12 -1
- package/src/components/ChipInviteStatus/__tests__/ChipInviteStatus.spec.js +0 -2
- package/src/components/Icon/Icon.stories.js +2 -2
- package/src/components/Tooltip/Tooltip.scss +14 -7
- package/src/components/Tooltip/Tooltip.stories.js +16 -1
- package/src/components/Tooltip/Tooltip.vue +47 -8
- package/src/components/Typography/Typography.scss +9 -2
- package/src/components/Typography/Typography.stories.js +36 -0
- package/src/components/Typography/Typography.vue +9 -0
- package/src/components/layout/Basic.stories.js +2 -2
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
.farm-btn {
|
|
6
6
|
font-size: 14px;
|
|
7
7
|
align-items: center;
|
|
8
|
-
border-radius:
|
|
8
|
+
border-radius: 6px;
|
|
9
9
|
display: inline-flex;
|
|
10
10
|
flex: 0 0 auto;
|
|
11
11
|
font-weight: 700;
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
min-width: 64px;
|
|
26
26
|
padding: 0 16px;
|
|
27
27
|
|
|
28
|
+
&.farm-btn--full {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
@each $size,
|
|
29
33
|
$value in $sizes {
|
|
30
34
|
&#{'.farm-btn[size=' + $size +']'} {
|
|
@@ -37,6 +41,7 @@
|
|
|
37
41
|
display: flex;
|
|
38
42
|
flex-direction: row;
|
|
39
43
|
align-items: center;
|
|
44
|
+
gap: 8px;
|
|
40
45
|
|
|
41
46
|
::v-deep i.mdi {
|
|
42
47
|
font-size: 1rem;
|
|
@@ -62,6 +67,8 @@
|
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
|
|
70
|
+
|
|
71
|
+
|
|
65
72
|
&:before {
|
|
66
73
|
transition: all 0.28s ease;
|
|
67
74
|
background-color: currentColor;
|
|
@@ -220,10 +227,15 @@
|
|
|
220
227
|
background-color: white;
|
|
221
228
|
|
|
222
229
|
i.mdi.farm-icon {
|
|
223
|
-
color:
|
|
230
|
+
color: #D6D6D6;
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
233
|
|
|
234
|
+
.farm-btn--plain.farm-btn--disabled {
|
|
235
|
+
background-color: transparent;
|
|
236
|
+
border: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
227
239
|
.farm-btn--elevated {
|
|
228
240
|
box-shadow: 0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%);
|
|
229
241
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import DefaultButton from './DefaultButton.vue';
|
|
2
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
3
2
|
import baseThemeColors from '../../../configurations/_theme-colors-base.scss';
|
|
4
|
-
const colors = Object.keys(baseThemeColors);
|
|
5
3
|
import './Buttons.stories.scss';
|
|
4
|
+
import DefaultButton from './DefaultButton.vue';
|
|
5
|
+
const colors = Object.keys(baseThemeColors);
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: 'Buttons/Default',
|
|
@@ -25,8 +25,42 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const
|
|
29
|
-
template: '<farm-btn
|
|
28
|
+
export const Default = () => ({
|
|
29
|
+
template: '<farm-btn color="primary"> Pass text as slot </farm-btn>',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Full = () => ({
|
|
33
|
+
template:
|
|
34
|
+
'<farm-btn color="primary" full> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const PrimaryActive = () => ({
|
|
38
|
+
template:
|
|
39
|
+
'<farm-btn color="primary"> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const PrimaryInactive = () => ({
|
|
43
|
+
template:
|
|
44
|
+
'<farm-btn disabled> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
45
|
+
});
|
|
46
|
+
export const SecondaryActive = () => ({
|
|
47
|
+
template:
|
|
48
|
+
'<farm-btn outlined> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const SecondaryInactive = () => ({
|
|
52
|
+
template:
|
|
53
|
+
'<farm-btn outlined disabled> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const TertiaryActive = () => ({
|
|
57
|
+
template:
|
|
58
|
+
'<farm-btn plain> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const TertiaryInactive = () => ({
|
|
62
|
+
template:
|
|
63
|
+
'<farm-btn plain disabled> <farm-icon>plus</farm-icon> Pass text as slot <farm-icon>plus</farm-icon></farm-btn>',
|
|
30
64
|
});
|
|
31
65
|
|
|
32
66
|
export const HtmlMarkup = () => ({
|
|
@@ -34,7 +68,7 @@ export const HtmlMarkup = () => ({
|
|
|
34
68
|
});
|
|
35
69
|
|
|
36
70
|
export const Props = () => ({
|
|
37
|
-
template: '<farm-btn
|
|
71
|
+
template: '<farm-btn outlined>props</farm-btn>',
|
|
38
72
|
});
|
|
39
73
|
|
|
40
74
|
export const Listener = () => ({
|
|
@@ -44,7 +78,7 @@ export const Listener = () => ({
|
|
|
44
78
|
};
|
|
45
79
|
},
|
|
46
80
|
template: `
|
|
47
|
-
<farm-btn color="error" @click="x
|
|
81
|
+
<farm-btn color="error" @click="x++">click me to change: {{ x }}</farm-btn>
|
|
48
82
|
`,
|
|
49
83
|
});
|
|
50
84
|
|
|
@@ -38,7 +38,6 @@ export default Vue.extend({
|
|
|
38
38
|
| 'success'
|
|
39
39
|
| 'error'
|
|
40
40
|
| 'warning'
|
|
41
|
-
| 'success'
|
|
42
41
|
| 'extra-1'
|
|
43
42
|
| 'extra-2'
|
|
44
43
|
>,
|
|
@@ -52,6 +51,10 @@ export default Vue.extend({
|
|
|
52
51
|
* Is plain
|
|
53
52
|
*/
|
|
54
53
|
plain: { type: Boolean, default: false },
|
|
54
|
+
/**
|
|
55
|
+
* Is full
|
|
56
|
+
*/
|
|
57
|
+
full: { type: Boolean, default: false },
|
|
55
58
|
/**
|
|
56
59
|
* Is disabled
|
|
57
60
|
*/
|
|
@@ -69,10 +72,17 @@ export default Vue.extend({
|
|
|
69
72
|
type: String,
|
|
70
73
|
default: 'button',
|
|
71
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* Denotes the target route of the link
|
|
77
|
+
* Will transform button into a router-link
|
|
78
|
+
*/
|
|
72
79
|
to: {
|
|
73
80
|
type: String,
|
|
74
81
|
default: null,
|
|
75
82
|
},
|
|
83
|
+
/**
|
|
84
|
+
* Size
|
|
85
|
+
*/
|
|
76
86
|
size: {
|
|
77
87
|
type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
|
|
78
88
|
default: 'default',
|
|
@@ -93,6 +103,7 @@ export default Vue.extend({
|
|
|
93
103
|
'farm-btn--round': this.isRound,
|
|
94
104
|
'farm-btn--rounded': this.rounded,
|
|
95
105
|
'farm-btn--icon': this.icon,
|
|
106
|
+
'farm-btn--full': this.full,
|
|
96
107
|
['farm-btn--' + this.color]: true,
|
|
97
108
|
...obj,
|
|
98
109
|
};
|
|
@@ -2,7 +2,6 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import ChipInviteStatus from '../ChipInviteStatus.vue';
|
|
3
3
|
describe('ChipInviteStatus component', () => {
|
|
4
4
|
let wrapper;
|
|
5
|
-
let component;
|
|
6
5
|
|
|
7
6
|
beforeEach(() => {
|
|
8
7
|
wrapper = shallowMount(ChipInviteStatus, {
|
|
@@ -10,7 +9,6 @@ describe('ChipInviteStatus component', () => {
|
|
|
10
9
|
status: 10,
|
|
11
10
|
},
|
|
12
11
|
});
|
|
13
|
-
component = wrapper.vm;
|
|
14
12
|
});
|
|
15
13
|
test('ChipInviteStatus created', () => {
|
|
16
14
|
expect(wrapper).toBeDefined();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
import baseThemeColors from '../../configurations/_theme-colors-base.scss';
|
|
3
|
-
const colors = Object.keys(baseThemeColors);
|
|
4
2
|
import sizes from '../../configurations/sizes';
|
|
3
|
+
import baseThemeColors from '../../configurations/_theme-colors-base.scss';
|
|
5
4
|
import iconsList from './icons_list';
|
|
5
|
+
const colors = Object.keys(baseThemeColors);
|
|
6
6
|
|
|
7
7
|
import('./Icons.stories.scss');
|
|
8
8
|
|
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
.farm-tooltip {
|
|
5
5
|
display: inline-block;
|
|
6
6
|
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.farm-tooltip__popup {
|
|
10
|
+
background-color: themeColor('primary');
|
|
7
11
|
|
|
8
12
|
@each $color in $colors {
|
|
9
13
|
@each $color in $theme-colors-list {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
&.farm-tooltip--#{$color} {
|
|
16
|
+
|
|
17
|
+
background-color: themeColor($color);
|
|
18
|
+
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -27,8 +31,11 @@
|
|
|
27
31
|
padding: 8px 12px;
|
|
28
32
|
position: absolute;
|
|
29
33
|
width: 160px;
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
background-color: themeColor('primary');
|
|
35
|
+
contain: content;
|
|
36
|
+
|
|
37
|
+
display: block;
|
|
38
|
+
font-family: 'Montserrat', sans-serif !important;
|
|
32
39
|
|
|
33
40
|
&--visible {
|
|
34
41
|
opacity: 1;
|
|
@@ -37,7 +37,9 @@ export const Tooltips = () => ({
|
|
|
37
37
|
:color="color"
|
|
38
38
|
style="margin-right: 4px"
|
|
39
39
|
>
|
|
40
|
-
|
|
40
|
+
<span>
|
|
41
|
+
this is the tooltip for {{ color }}
|
|
42
|
+
</span>
|
|
41
43
|
<template v-slot:activator="{ on, attrs }">
|
|
42
44
|
{{ color }}
|
|
43
45
|
</template>
|
|
@@ -83,3 +85,16 @@ export const Visibility = () => ({
|
|
|
83
85
|
</farm-tooltip>
|
|
84
86
|
</div>`,
|
|
85
87
|
});
|
|
88
|
+
|
|
89
|
+
export const TooltipTest = () => ({
|
|
90
|
+
template: `<div style="padding-left: 80px; padding-top: 80px;">
|
|
91
|
+
<farm-card style="padding: 32px">
|
|
92
|
+
<farm-tooltip>
|
|
93
|
+
this is the tooltip!
|
|
94
|
+
<template v-slot:activator="{ on, attrs }">
|
|
95
|
+
<farm-btn style="height: 80px">try me</farm-btn>
|
|
96
|
+
</template>
|
|
97
|
+
</farm-tooltip>
|
|
98
|
+
</farm-card>
|
|
99
|
+
</div>`,
|
|
100
|
+
});
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
>
|
|
8
|
-
<slot name="activator"></slot>
|
|
2
|
+
<span :class="{ 'farm-tooltip': true }" ref="parent">
|
|
3
|
+
<span @mouseover="onOver" @mouseout="onOut" ref="activator">
|
|
4
|
+
<slot name="activator"></slot>
|
|
5
|
+
</span>
|
|
6
|
+
|
|
9
7
|
<span
|
|
8
|
+
ref="popup"
|
|
10
9
|
:class="{
|
|
11
10
|
'farm-tooltip__popup': true,
|
|
11
|
+
['farm-tooltip--' + color]: true,
|
|
12
12
|
'farm-tooltip__popup--visible':
|
|
13
13
|
(!externalControl && showOver) || (externalControl && toggleComponent),
|
|
14
14
|
}"
|
|
15
|
+
:style="styles"
|
|
16
|
+
@mouseout="onOut"
|
|
15
17
|
>
|
|
16
18
|
<slot></slot>
|
|
17
19
|
</span>
|
|
18
20
|
</span>
|
|
19
21
|
</template>
|
|
20
22
|
<script lang="ts">
|
|
21
|
-
import Vue, { PropType, ref, computed } from 'vue';
|
|
23
|
+
import Vue, { PropType, ref, computed, reactive, onBeforeUnmount } from 'vue';
|
|
22
24
|
|
|
23
25
|
export default Vue.extend({
|
|
24
26
|
name: 'farm-tooltip',
|
|
@@ -52,23 +54,60 @@ export default Vue.extend({
|
|
|
52
54
|
},
|
|
53
55
|
setup(props) {
|
|
54
56
|
const parent = ref(null);
|
|
57
|
+
const popup = ref(null);
|
|
58
|
+
const activator = ref(null);
|
|
55
59
|
const showOver = ref(false);
|
|
60
|
+
const styles = reactive({
|
|
61
|
+
left: '0',
|
|
62
|
+
top: '0',
|
|
63
|
+
});
|
|
56
64
|
|
|
57
65
|
const toggleComponent = computed(() => props.value);
|
|
58
66
|
const externalControl = computed(() => props.value !== undefined);
|
|
59
67
|
|
|
68
|
+
let hasBeenBoostrapped = false;
|
|
69
|
+
|
|
60
70
|
const onOver = () => {
|
|
61
71
|
showOver.value = true;
|
|
72
|
+
|
|
73
|
+
if (!hasBeenBoostrapped) {
|
|
74
|
+
document.querySelector('body').appendChild(popup.value);
|
|
75
|
+
const parentBoundingClientRect = parent.value.getBoundingClientRect();
|
|
76
|
+
const activatorBoundingClientRect = activator.value.getBoundingClientRect();
|
|
77
|
+
const popupBoundingClientRect = popup.value.getBoundingClientRect();
|
|
78
|
+
|
|
79
|
+
styles.left =
|
|
80
|
+
parentBoundingClientRect.left +
|
|
81
|
+
window.scrollX -
|
|
82
|
+
(80 - activatorBoundingClientRect.width / 2) +
|
|
83
|
+
'px';
|
|
84
|
+
styles.top =
|
|
85
|
+
parentBoundingClientRect.top +
|
|
86
|
+
window.scrollY -
|
|
87
|
+
(popupBoundingClientRect.height + 8) +
|
|
88
|
+
'px';
|
|
89
|
+
|
|
90
|
+
hasBeenBoostrapped = true;
|
|
91
|
+
}
|
|
62
92
|
};
|
|
63
93
|
const onOut = (event: MouseEvent) => {
|
|
64
94
|
showOver.value = parent.value.contains(event.relatedTarget);
|
|
65
95
|
};
|
|
66
96
|
|
|
97
|
+
onBeforeUnmount(() => {
|
|
98
|
+
if (hasBeenBoostrapped) {
|
|
99
|
+
document.querySelector('body').removeChild(popup.value);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
67
103
|
return {
|
|
68
104
|
parent,
|
|
105
|
+
popup,
|
|
106
|
+
activator,
|
|
69
107
|
showOver,
|
|
70
108
|
toggleComponent,
|
|
71
109
|
externalControl,
|
|
110
|
+
styles,
|
|
72
111
|
onOver,
|
|
73
112
|
onOut,
|
|
74
113
|
};
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
@each $k in $theme-colors-list {
|
|
31
31
|
&#{'[color=' + $k + ']'} {
|
|
32
32
|
color: var(--farm-#{$k}-base);
|
|
33
|
+
|
|
34
|
+
&.farm-typography--lighten {
|
|
35
|
+
color: var(--farm-#{$k}-lighten);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.farm-typography--darken {
|
|
39
|
+
color: var(--farm-#{$k}-darken);
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
43
|
|
|
@@ -59,5 +67,4 @@
|
|
|
59
67
|
font-size: calc(#{$val} - 2px);
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
70
|
+
}
|
|
@@ -105,6 +105,42 @@ export const Colors = () => ({
|
|
|
105
105
|
</div>`,
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
export const ColorsLighten = () => ({
|
|
109
|
+
data() {
|
|
110
|
+
return {
|
|
111
|
+
colors: [ ...colors, 'white'],
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
template: `<div>
|
|
115
|
+
<farm-typography
|
|
116
|
+
v-for="color in colors"
|
|
117
|
+
color-variation="lighten"
|
|
118
|
+
:color="color"
|
|
119
|
+
:key="'lighten' + color"
|
|
120
|
+
>
|
|
121
|
+
Typography - color {{ color }} lighten
|
|
122
|
+
</farm-typography>
|
|
123
|
+
</div>`,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export const ColorsDarken = () => ({
|
|
127
|
+
data() {
|
|
128
|
+
return {
|
|
129
|
+
colors: [...colors, 'white'],
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
template: `<div>
|
|
133
|
+
<farm-typography
|
|
134
|
+
v-for="color in colors"
|
|
135
|
+
color-variation="darken"
|
|
136
|
+
:color="color"
|
|
137
|
+
:key="'darken' + color"
|
|
138
|
+
>
|
|
139
|
+
Typography - color {{ color }} darken
|
|
140
|
+
</farm-typography>
|
|
141
|
+
</div>`,
|
|
142
|
+
});
|
|
143
|
+
|
|
108
144
|
export const Tags = () => ({
|
|
109
145
|
data() {
|
|
110
146
|
return {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
'farm-typography': true,
|
|
6
6
|
['farm-typography--' + $props.size]: isSizeFromBreakpoints,
|
|
7
7
|
['farm-typography--weight-' + weight]: weight !== undefined,
|
|
8
|
+
'farm-typography--lighten': colorVariation === 'lighten',
|
|
9
|
+
'farm-typography--darken': colorVariation === 'darken',
|
|
8
10
|
}"
|
|
9
11
|
:style="style"
|
|
10
12
|
:color="color"
|
|
@@ -54,6 +56,13 @@ export default Vue.extend({
|
|
|
54
56
|
>,
|
|
55
57
|
default: 'default',
|
|
56
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* Color variation
|
|
61
|
+
*/
|
|
62
|
+
colorVariation: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
57
66
|
},
|
|
58
67
|
setup(props) {
|
|
59
68
|
const { size, lineHeight } = toRefs(props);
|
|
@@ -35,7 +35,7 @@ export const Structure = () => ({
|
|
|
35
35
|
<farm-row>
|
|
36
36
|
<farm-col md="6" lg="3">
|
|
37
37
|
coluna 1
|
|
38
|
-
</farm-col
|
|
38
|
+
</farm-col>›
|
|
39
39
|
<farm-col md="6" lg="3">
|
|
40
40
|
coluna 2
|
|
41
41
|
</farm-col>
|
|
@@ -46,7 +46,7 @@ export const Structure = () => ({
|
|
|
46
46
|
coluna 4
|
|
47
47
|
</farm-col>
|
|
48
48
|
</farm-row>
|
|
49
|
-
<farm-row extra-decrease="true">
|
|
49
|
+
<farm-row :extra-decrease="true">
|
|
50
50
|
<farm-container-footer>
|
|
51
51
|
Footer content
|
|
52
52
|
</farm-container-footer>
|