@farm-investimentos/front-mfe-components 15.14.6 → 15.14.7

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.6",
3
+ "version": "15.14.7",
4
4
  "author": "farm investimentos",
5
5
  "private": false,
6
6
  "main": "./dist/front-mfe-components.common.js",
@@ -36,8 +36,8 @@
36
36
  font-size: 12px;
37
37
  font-weight: 500;
38
38
  padding: 16px;
39
- position: fixed; /* SEMPRE fixed agora */
40
- z-index: 10004; /* z-index alto para aparecer sobre modais (modal usa z-index 102, header/footer 103) */
39
+ position: fixed;
40
+ z-index: 10001;
41
41
  transform: translateZ(0);
42
42
  pointer-events: auto;
43
43
 
@@ -96,7 +96,7 @@
96
96
  font-weight: 500;
97
97
  padding: 16px;
98
98
  position: fixed;
99
- z-index: 10004; /* z-index alto para aparecer sobre modais (modal usa z-index 102, header/footer 103) */
99
+ z-index: 10001;
100
100
  transform: translateZ(0);
101
101
  pointer-events: auto;
102
102
 
@@ -138,13 +138,12 @@
138
138
  color: #f5f5f5;
139
139
  }
140
140
 
141
- /* Seta presa ao tooltip */
142
141
  .tooltip-arrow {
143
142
  position: absolute;
144
143
  width: 0;
145
144
  height: 0;
146
145
  border-style: solid;
147
- z-index: 10005; /* z-index ainda maior para a seta */
146
+ z-index: inherit;
148
147
  pointer-events: none;
149
148
  }
150
149
  }
@@ -104,6 +104,46 @@ export default defineComponent({
104
104
  const tooltipRef = ref<HTMLElement | null>(null);
105
105
  const scrollableElementsRef = ref<Element[] | null>(null);
106
106
 
107
+ const Z_INDEX_OFFSET = 1000;
108
+ const DEFAULT_Z_INDEX = 10001;
109
+
110
+ let modalCache: { modals: Element[]; timestamp: number } | null = null;
111
+
112
+ const getTooltipZIndex = () => {
113
+ const now = Date.now();
114
+ let modals: Element[];
115
+
116
+ if (modalCache && now - modalCache.timestamp < 500) {
117
+ modals = modalCache.modals;
118
+ } else {
119
+ modals = Array.from(document.querySelectorAll('.farm-modal'));
120
+ modalCache = { modals, timestamp: now };
121
+ }
122
+
123
+ let maxModalZIndex = 0;
124
+
125
+ modals.forEach(modal => {
126
+ const htmlModal = modal as HTMLElement;
127
+
128
+ let zIndex = parseInt(htmlModal.style.zIndex, 10);
129
+
130
+ if (Number.isNaN(zIndex)) {
131
+ const computedZIndex = window.getComputedStyle(htmlModal).zIndex;
132
+ if (computedZIndex === 'auto') {
133
+ zIndex = 0;
134
+ } else {
135
+ zIndex = parseInt(computedZIndex, 10) || 0;
136
+ }
137
+ }
138
+
139
+ if (zIndex > maxModalZIndex) {
140
+ maxModalZIndex = zIndex;
141
+ }
142
+ });
143
+
144
+ return maxModalZIndex > 0 ? maxModalZIndex + Z_INDEX_OFFSET : DEFAULT_Z_INDEX;
145
+ };
146
+
107
147
  const isVisible = ref(false);
108
148
 
109
149
  const isControlled = computed(() => props.value !== undefined);
@@ -136,7 +176,7 @@ export default defineComponent({
136
176
  const tooltipStyles = computed(() => {
137
177
  const styles: Record<string, string> = {
138
178
  position: 'fixed',
139
- zIndex: '9999',
179
+ zIndex: String(getTooltipZIndex()),
140
180
  };
141
181
 
142
182
  if (normalizedMaxWidth.value) {
@@ -158,7 +198,7 @@ export default defineComponent({
158
198
  width: '0',
159
199
  height: '0',
160
200
  borderStyle: 'solid',
161
- zIndex: '10000',
201
+ zIndex: 'inherit',
162
202
  };
163
203
 
164
204
  if (verticalPos === 'top') {