@farm-investimentos/front-mfe-components 11.6.1 → 11.6.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 +134 -169
- 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 +134 -169
- 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/ConfirmButton/ConfirmButton.stories.js +4 -12
- package/src/components/Buttons/ConfirmButton/ConfirmButton.vue +5 -15
- package/src/components/Buttons/ConfirmButton/__tests__/ConfirmButton.spec.js +0 -19
- package/src/components/Buttons/DangerButton/DangerButton.stories.js +3 -1
- package/src/components/Buttons/DangerButton/DangerButton.vue +3 -9
- package/src/components/Buttons/DangerButton/__tests__/DangerButton.spec.js +0 -19
- package/src/components/CopyToClipboard/CopyToClipboard.stories.js +22 -0
- package/src/components/CopyToClipboard/CopyToClipboard.vue +9 -2
- package/src/components/TextFieldV2/TextFieldV2.scss +1 -1
- package/src/components/TextFieldV2/TextFieldV2.stories.js +25 -1
- package/src/components/Tooltip/Tooltip.vue +4 -1
package/package.json
CHANGED
|
@@ -7,7 +7,8 @@ export default {
|
|
|
7
7
|
docs: {
|
|
8
8
|
description: {
|
|
9
9
|
component: `Confirm button<br />
|
|
10
|
-
selector: <em>farm-btn-confirm</em
|
|
10
|
+
selector: <em>farm-btn-confirm</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
11
12
|
`,
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -16,22 +17,18 @@ export default {
|
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export const Primary = () => ({
|
|
19
|
-
components: { ConfirmButton },
|
|
20
20
|
template: '<ConfirmButton>Confirm Button</ConfirmButton>',
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export const HtmlMarkup = () => ({
|
|
24
|
-
components: { ConfirmButton },
|
|
25
24
|
template: '<ConfirmButton><em>I am italic</strong></em></ConfirmButton>',
|
|
26
25
|
});
|
|
27
26
|
|
|
28
27
|
export const Props = () => ({
|
|
29
|
-
components: { ConfirmButton },
|
|
30
28
|
template: '<ConfirmButton title="custom title">custom title (hover me)</ConfirmButton>',
|
|
31
29
|
});
|
|
32
30
|
|
|
33
31
|
export const Listener = () => ({
|
|
34
|
-
components: { ConfirmButton },
|
|
35
32
|
data() {
|
|
36
33
|
return {
|
|
37
34
|
x: 1,
|
|
@@ -48,11 +45,6 @@ export const Iconed = () => ({
|
|
|
48
45
|
<ConfirmButton :icon="true">default icon</ConfirmButton>
|
|
49
46
|
<ConfirmButton :icon="true" customIcon="information-outline">information-outline</ConfirmButton>
|
|
50
47
|
<ConfirmButton :icon="true" customIcon="account-search">account-search</ConfirmButton>
|
|
48
|
+
<ConfirmButton :icon="true" customIcon="account-search" disabled>account-search</ConfirmButton>
|
|
51
49
|
</div>`,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
Primary.storyName = 'Básico';
|
|
55
|
-
HtmlMarkup.storyName = 'Html Markup';
|
|
56
|
-
Props.storyName = 'Props';
|
|
57
|
-
Listener.storyName = 'Listener';
|
|
58
|
-
Iconed.storyName = 'Icon';
|
|
50
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<farm-btn v-bind="$attrs" v-on="$listeners">
|
|
3
|
-
<
|
|
3
|
+
<farm-icon v-if="icon" class="'mr-3">
|
|
4
|
+
{{ customIcon }}
|
|
5
|
+
</farm-icon>
|
|
4
6
|
<slot></slot>
|
|
5
7
|
</farm-btn>
|
|
6
8
|
</template>
|
|
@@ -23,21 +25,9 @@ export default Vue.extend({
|
|
|
23
25
|
*/
|
|
24
26
|
customIcon: {
|
|
25
27
|
type: String,
|
|
26
|
-
default: '',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
iconPath() {
|
|
31
|
-
if (!this.customIcon) {
|
|
32
|
-
return 'mdi-check';
|
|
33
|
-
}
|
|
34
|
-
return `mdi-${this.customIcon}`;
|
|
28
|
+
default: 'check',
|
|
35
29
|
},
|
|
36
30
|
},
|
|
37
31
|
});
|
|
38
32
|
</script>
|
|
39
|
-
|
|
40
|
-
i.mdi {
|
|
41
|
-
font-size: 1rem;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
33
|
+
|
|
@@ -3,31 +3,12 @@ import ConfirmButton from '../ConfirmButton';
|
|
|
3
3
|
|
|
4
4
|
describe('ConfirmButton component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
-
let component;
|
|
7
6
|
|
|
8
7
|
beforeEach(() => {
|
|
9
8
|
wrapper = shallowMount(ConfirmButton);
|
|
10
|
-
component = wrapper.vm;
|
|
11
9
|
});
|
|
12
10
|
|
|
13
11
|
test('Created hook', () => {
|
|
14
12
|
expect(wrapper).toBeDefined();
|
|
15
13
|
});
|
|
16
|
-
|
|
17
|
-
describe('Computed properties', () => {
|
|
18
|
-
it('Should return default icon', () => {
|
|
19
|
-
wrapper.setProps({
|
|
20
|
-
icon: true,
|
|
21
|
-
});
|
|
22
|
-
expect(component.iconPath).toEqual('mdi-check');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('Should return custom icon', async () => {
|
|
26
|
-
await wrapper.setProps({
|
|
27
|
-
icon: true,
|
|
28
|
-
customIcon: 'information',
|
|
29
|
-
});
|
|
30
|
-
expect(component.iconPath).toEqual('mdi-information');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
14
|
});
|
|
@@ -7,7 +7,8 @@ export default {
|
|
|
7
7
|
docs: {
|
|
8
8
|
description: {
|
|
9
9
|
component: `Danger button<br />
|
|
10
|
-
selector: <em>farm-btn-fanger</em
|
|
10
|
+
selector: <em>farm-btn-fanger</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
11
12
|
`,
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -43,5 +44,6 @@ export const Iconed = () => ({
|
|
|
43
44
|
<farm-btn-danger :icon="true">default icon</farm-btn-danger>
|
|
44
45
|
<farm-btn-danger :icon="true" customIcon="information-outline">information-outline</farm-btn-danger>
|
|
45
46
|
<farm-btn-danger :icon="true" customIcon="account-search">account-search</farm-btn-danger>
|
|
47
|
+
<farm-btn-danger :icon="true" customIcon="account-search" disabled>account-search</farm-btn-danger>
|
|
46
48
|
</div>`,
|
|
47
49
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<farm-btn v-bind="$attrs" v-on="$listeners" color="error">
|
|
3
|
-
<
|
|
3
|
+
<farm-icon v-if="icon" class="'mr-3">
|
|
4
|
+
{{ customIcon }}
|
|
5
|
+
</farm-icon>
|
|
4
6
|
<slot></slot>
|
|
5
7
|
</farm-btn>
|
|
6
8
|
</template>
|
|
@@ -26,13 +28,5 @@ export default Vue.extend({
|
|
|
26
28
|
default: '',
|
|
27
29
|
},
|
|
28
30
|
},
|
|
29
|
-
computed: {
|
|
30
|
-
iconPath(): string {
|
|
31
|
-
if (!this.customIcon) {
|
|
32
|
-
return 'mdi-trash-can-outline';
|
|
33
|
-
}
|
|
34
|
-
return `mdi-${this.customIcon}`;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
31
|
});
|
|
38
32
|
</script>
|
|
@@ -3,31 +3,12 @@ import DangerButton from '../DangerButton';
|
|
|
3
3
|
|
|
4
4
|
describe('DangerButton component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
-
let component;
|
|
7
6
|
|
|
8
7
|
beforeEach(() => {
|
|
9
8
|
wrapper = shallowMount(DangerButton);
|
|
10
|
-
component = wrapper.vm;
|
|
11
9
|
});
|
|
12
10
|
|
|
13
11
|
test('Created hook', () => {
|
|
14
12
|
expect(wrapper).toBeDefined();
|
|
15
13
|
});
|
|
16
|
-
|
|
17
|
-
describe('Computed properties', () => {
|
|
18
|
-
it('Should return default icon', () => {
|
|
19
|
-
wrapper.setProps({
|
|
20
|
-
icon: true,
|
|
21
|
-
});
|
|
22
|
-
expect(component.iconPath).toEqual('mdi-trash-can-outline');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('Should return custom icon', async () => {
|
|
26
|
-
await wrapper.setProps({
|
|
27
|
-
icon: true,
|
|
28
|
-
customIcon: 'information',
|
|
29
|
-
});
|
|
30
|
-
expect(component.iconPath).toEqual('mdi-information');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
14
|
});
|
|
@@ -41,3 +41,25 @@ export const CustomTooltipColor = () => ({
|
|
|
41
41
|
<farm-copytoclipboard toCopy="To be copied" tooltip-color="info" />
|
|
42
42
|
</div>`,
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
export const Modal = () => ({
|
|
46
|
+
data() {
|
|
47
|
+
return {
|
|
48
|
+
value: false,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
template: `<div>
|
|
52
|
+
<farm-btn @click="value = true">abrir</farm-btn>
|
|
53
|
+
<farm-modal v-model="value">
|
|
54
|
+
<template v-slot:content>
|
|
55
|
+
<farm-copytoclipboard toCopy="To be copied" :isIcon="false" />
|
|
56
|
+
</template>
|
|
57
|
+
</farm-modal>
|
|
58
|
+
</div>`,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const SuccessTimeout = () => ({
|
|
62
|
+
template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
|
|
63
|
+
<farm-copytoclipboard toCopy="To be copied" success-timeout="5000" />
|
|
64
|
+
</div>`,
|
|
65
|
+
});
|
|
@@ -53,12 +53,19 @@ export default Vue.extend({
|
|
|
53
53
|
>,
|
|
54
54
|
default: 'secondary',
|
|
55
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* Success message timeout (in ms)
|
|
58
|
+
*/
|
|
59
|
+
successTimeout: {
|
|
60
|
+
type: [Number, String],
|
|
61
|
+
default: 2000,
|
|
62
|
+
},
|
|
56
63
|
},
|
|
57
64
|
setup(props) {
|
|
58
65
|
const show = ref(false);
|
|
59
66
|
const feedbackMessage = ref('');
|
|
60
67
|
const disabled = ref(false);
|
|
61
|
-
const { toCopy, isIcon, successMessage } = toRefs(props);
|
|
68
|
+
const { toCopy, isIcon, successMessage, successTimeout } = toRefs(props);
|
|
62
69
|
|
|
63
70
|
const onClick = async () => {
|
|
64
71
|
disabled.value = true;
|
|
@@ -73,7 +80,7 @@ export default Vue.extend({
|
|
|
73
80
|
setTimeout(() => {
|
|
74
81
|
show.value = false;
|
|
75
82
|
disabled.value = false;
|
|
76
|
-
},
|
|
83
|
+
}, successTimeout.value);
|
|
77
84
|
};
|
|
78
85
|
|
|
79
86
|
return {
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
description: {
|
|
21
21
|
component: `Text field v2<br />
|
|
22
22
|
selector: <em>farm-texfield-v2</em><br />
|
|
23
|
-
<span style="color: var(--farm-
|
|
23
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
24
24
|
`,
|
|
25
25
|
},
|
|
26
26
|
},
|
|
@@ -229,3 +229,27 @@ export const ToggleVisibility = () => ({
|
|
|
229
229
|
<farm-textfield-v2 v-model="v" :type="visible ? 'text' : 'password'" :icon="visible ? 'eye-off' : 'eye'" @onClickIcon="toggle" />
|
|
230
230
|
</div>`,
|
|
231
231
|
});
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
export const Compare = () => ({
|
|
235
|
+
data() {
|
|
236
|
+
return {
|
|
237
|
+
v1: '',
|
|
238
|
+
rules: {
|
|
239
|
+
required: value => !!value || 'Required field',
|
|
240
|
+
email: v =>
|
|
241
|
+
!v ||
|
|
242
|
+
/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
|
|
243
|
+
'Must be an e-mail',
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
template: `<div style="width: 480px">
|
|
248
|
+
|
|
249
|
+
<farm-label required>Required and e-mail</farm-label>
|
|
250
|
+
<farm-textfield-v2 v-model="v1" :rules="[rules.required, rules.email]" />
|
|
251
|
+
|
|
252
|
+
<farm-textfield v-model="v1" :rules="[rules.required, rules.email]" />
|
|
253
|
+
|
|
254
|
+
</div>`,
|
|
255
|
+
});
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import Vue, { PropType, ref, computed, reactive, onBeforeUnmount } from 'vue';
|
|
24
|
+
import { calculateMainZindex } from '../../helpers';
|
|
24
25
|
|
|
25
26
|
export default Vue.extend({
|
|
26
27
|
name: 'farm-tooltip',
|
|
@@ -60,6 +61,7 @@ export default Vue.extend({
|
|
|
60
61
|
const styles = reactive({
|
|
61
62
|
left: '0',
|
|
62
63
|
top: '0',
|
|
64
|
+
zIndex: 1,
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
const toggleComponent = computed(() => props.value);
|
|
@@ -86,7 +88,8 @@ export default Vue.extend({
|
|
|
86
88
|
window.scrollY -
|
|
87
89
|
(popupBoundingClientRect.height + 8) +
|
|
88
90
|
'px';
|
|
89
|
-
|
|
91
|
+
styles.zIndex = calculateMainZindex();
|
|
92
|
+
|
|
90
93
|
hasBeenBoostrapped = true;
|
|
91
94
|
}
|
|
92
95
|
};
|