@farm-investimentos/front-mfe-components 15.14.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm-investimentos/front-mfe-components",
3
- "version": "15.14.1",
3
+ "version": "15.14.2",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -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 class="farm-tooltip__activator" ref="activator" @mouseover="onOver" @mouseout="onOut">
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
- showOver.value = parent.value.contains(event.relatedTarget);
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
  }