@farm-investimentos/front-mfe-components 15.14.0 → 15.14.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 +180 -145
- 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 +180 -145
- 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/FilterEmptyState/FilterEmptyState.vue +12 -9
- package/src/components/FilterEmptyState/__tests__/FilterEmptyState.test.js +25 -3
- package/src/components/Tooltip/Tooltip.scss +2 -2
- package/src/components/Tooltip/Tooltip.vue +38 -2
package/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<farm-box>
|
|
3
3
|
<farm-row justify="center" class="mb-4">
|
|
4
4
|
<img
|
|
5
|
-
v-if="
|
|
6
|
-
:src="
|
|
7
|
-
:alt="
|
|
5
|
+
v-if="isNotFound"
|
|
6
|
+
:src="isNotFoundImage"
|
|
7
|
+
:alt="isNotFoundImageAlt"
|
|
8
8
|
class="filter-empty-state__image"
|
|
9
9
|
/>
|
|
10
10
|
<img
|
|
11
|
-
v-else
|
|
12
|
-
:src="
|
|
13
|
-
:alt="
|
|
11
|
+
v-else
|
|
12
|
+
:src="isEmptyImage"
|
|
13
|
+
:alt="isEmptyImageAlt"
|
|
14
14
|
class="filter-empty-state__image"
|
|
15
15
|
/>
|
|
16
16
|
</farm-row>
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
<script lang="ts">
|
|
35
35
|
import { defineComponent, PropType } from 'vue';
|
|
36
36
|
|
|
37
|
+
const emptyDataImage: string = require('../../assets/imgs/empty-data.svg');
|
|
38
|
+
const emptyNotFoundImage: string = require('../../assets/imgs/empty-not-found.svg');
|
|
39
|
+
|
|
37
40
|
export type FilterEmptyStateProps = {
|
|
38
41
|
/**
|
|
39
42
|
* Indicates if the state is empty (no data)
|
|
@@ -77,7 +80,7 @@ export default defineComponent({
|
|
|
77
80
|
*/
|
|
78
81
|
isEmpty: {
|
|
79
82
|
type: Boolean as PropType<FilterEmptyStateProps['isEmpty']>,
|
|
80
|
-
default:
|
|
83
|
+
default: true,
|
|
81
84
|
},
|
|
82
85
|
/**
|
|
83
86
|
* Indicates if the state is not found (no results from filter)
|
|
@@ -91,7 +94,7 @@ export default defineComponent({
|
|
|
91
94
|
*/
|
|
92
95
|
isEmptyImage: {
|
|
93
96
|
type: String as PropType<FilterEmptyStateProps['isEmptyImage']>,
|
|
94
|
-
default:
|
|
97
|
+
default: emptyDataImage,
|
|
95
98
|
},
|
|
96
99
|
/**
|
|
97
100
|
* Alt text for empty state image
|
|
@@ -105,7 +108,7 @@ export default defineComponent({
|
|
|
105
108
|
*/
|
|
106
109
|
isNotFoundImage: {
|
|
107
110
|
type: String as PropType<FilterEmptyStateProps['isNotFoundImage']>,
|
|
108
|
-
default:
|
|
111
|
+
default: emptyNotFoundImage,
|
|
109
112
|
},
|
|
110
113
|
/**
|
|
111
114
|
* Alt text for not found state image
|
|
@@ -88,13 +88,21 @@ describe('FilterEmptyState', () => {
|
|
|
88
88
|
stubs: globalStubs,
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
expect(wrapper.props('isEmpty')).toBe(
|
|
91
|
+
expect(wrapper.props('isEmpty')).toBe(true);
|
|
92
92
|
expect(wrapper.props('isNotFound')).toBe(false);
|
|
93
93
|
expect(wrapper.props('title')).toBe('');
|
|
94
94
|
expect(wrapper.props('subtitle')).toBe('');
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
it('
|
|
97
|
+
it('shows empty image by default when no props are provided', () => {
|
|
98
|
+
const wrapper = mount(FilterEmptyState, {
|
|
99
|
+
stubs: globalStubs,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('shows empty image when isEmpty is false and isNotFound is false', () => {
|
|
98
106
|
const wrapper = mount(FilterEmptyState, {
|
|
99
107
|
propsData: {
|
|
100
108
|
isEmpty: false,
|
|
@@ -103,6 +111,20 @@ describe('FilterEmptyState', () => {
|
|
|
103
111
|
stubs: globalStubs,
|
|
104
112
|
});
|
|
105
113
|
|
|
106
|
-
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(
|
|
114
|
+
expect(wrapper.find('.filter-empty-state__image').exists()).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('prioritizes isNotFound over isEmpty', () => {
|
|
118
|
+
const wrapper = mount(FilterEmptyState, {
|
|
119
|
+
propsData: {
|
|
120
|
+
isEmpty: true,
|
|
121
|
+
isNotFound: true,
|
|
122
|
+
},
|
|
123
|
+
stubs: globalStubs,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const img = wrapper.find('.filter-empty-state__image');
|
|
127
|
+
expect(img.exists()).toBe(true);
|
|
128
|
+
expect(img.attributes('alt')).toBe('Imagem referente a filtro vazio');
|
|
107
129
|
});
|
|
108
130
|
});
|
|
@@ -70,7 +70,7 @@ $arrow-margin: 12px;
|
|
|
70
70
|
&--top-right .farm-tooltip__arrow {
|
|
71
71
|
border-width: $arrow-size $arrow-size 0 $arrow-size;
|
|
72
72
|
border-color: $tooltip-color transparent transparent transparent;
|
|
73
|
-
bottom: -$arrow-size;
|
|
73
|
+
bottom: -$arrow-size + 1px;
|
|
74
74
|
z-index: 99999;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -80,7 +80,7 @@ $arrow-margin: 12px;
|
|
|
80
80
|
&--bottom-right .farm-tooltip__arrow {
|
|
81
81
|
border-width: 0 $arrow-size $arrow-size $arrow-size;
|
|
82
82
|
border-color: transparent transparent $tooltip-color transparent;
|
|
83
|
-
top: -$arrow-size;
|
|
83
|
+
top: -$arrow-size + 1px;
|
|
84
84
|
z-index: 99999;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span :class="{ 'farm-tooltip': true }" ref="parent">
|
|
3
|
-
<span
|
|
3
|
+
<span
|
|
4
|
+
class="farm-tooltip__activator"
|
|
5
|
+
ref="activator"
|
|
6
|
+
@mouseover="onOver"
|
|
7
|
+
@mouseout="onOut"
|
|
8
|
+
@mouseleave="onOut"
|
|
9
|
+
>
|
|
4
10
|
<slot name="activator" />
|
|
5
11
|
</span>
|
|
6
12
|
|
|
@@ -16,6 +22,7 @@
|
|
|
16
22
|
}"
|
|
17
23
|
:style="styles"
|
|
18
24
|
@mouseout="onOut"
|
|
25
|
+
@mouseleave="onOut"
|
|
19
26
|
>
|
|
20
27
|
<div v-if="hasTitle" class="farm-tooltip__header">
|
|
21
28
|
<div class="farm-tooltip__title">
|
|
@@ -88,6 +95,7 @@ export default defineComponent({
|
|
|
88
95
|
zIndex: 1,
|
|
89
96
|
});
|
|
90
97
|
const slots = useSlots();
|
|
98
|
+
let hideTimeout: number | null = null;
|
|
91
99
|
|
|
92
100
|
const toggleComponent = computed(() => props.value);
|
|
93
101
|
const externalControl = computed(() => props.value !== undefined);
|
|
@@ -159,6 +167,12 @@ export default defineComponent({
|
|
|
159
167
|
};
|
|
160
168
|
|
|
161
169
|
const onOver = () => {
|
|
170
|
+
// Limpa qualquer timeout de hide
|
|
171
|
+
if (hideTimeout) {
|
|
172
|
+
clearTimeout(hideTimeout);
|
|
173
|
+
hideTimeout = null;
|
|
174
|
+
}
|
|
175
|
+
|
|
162
176
|
showOver.value = true;
|
|
163
177
|
|
|
164
178
|
if (!hasBeenBoostrapped) {
|
|
@@ -174,7 +188,23 @@ export default defineComponent({
|
|
|
174
188
|
};
|
|
175
189
|
|
|
176
190
|
const onOut = (event: MouseEvent) => {
|
|
177
|
-
|
|
191
|
+
// Limpa qualquer timeout anterior
|
|
192
|
+
if (hideTimeout) {
|
|
193
|
+
clearTimeout(hideTimeout);
|
|
194
|
+
hideTimeout = null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Verifica se o relatedTarget está contido no parent
|
|
198
|
+
const isRelatedTargetInParent =
|
|
199
|
+
event.relatedTarget && parent.value.contains(event.relatedTarget);
|
|
200
|
+
|
|
201
|
+
if (!isRelatedTargetInParent) {
|
|
202
|
+
// Se não está no parent, agenda o hide com um pequeno delay para evitar flickering
|
|
203
|
+
hideTimeout = window.setTimeout(() => {
|
|
204
|
+
showOver.value = false;
|
|
205
|
+
hideTimeout = null;
|
|
206
|
+
}, 50);
|
|
207
|
+
}
|
|
178
208
|
};
|
|
179
209
|
|
|
180
210
|
const onClose = () => {
|
|
@@ -185,6 +215,12 @@ export default defineComponent({
|
|
|
185
215
|
};
|
|
186
216
|
|
|
187
217
|
onBeforeUnmount(() => {
|
|
218
|
+
// Limpa o timeout se existir
|
|
219
|
+
if (hideTimeout) {
|
|
220
|
+
clearTimeout(hideTimeout);
|
|
221
|
+
hideTimeout = null;
|
|
222
|
+
}
|
|
223
|
+
|
|
188
224
|
if (hasBeenBoostrapped) {
|
|
189
225
|
document.querySelector('body').removeChild(popup.value);
|
|
190
226
|
}
|