@eric-emg/symphiq-components 1.2.81 → 1.2.82
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/fesm2022/symphiq-components.mjs +53 -25
- package/fesm2022/symphiq-components.mjs.map +1 -1
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -11247,6 +11247,10 @@ class TooltipContainerComponent {
|
|
|
11247
11247
|
const rect = this.targetRect();
|
|
11248
11248
|
if (!rect)
|
|
11249
11249
|
return 0;
|
|
11250
|
+
// Find if there's a transformed ancestor that changes the positioning context
|
|
11251
|
+
// When an ancestor has transform, position:fixed is relative to that ancestor, not viewport
|
|
11252
|
+
const transformedAncestor = this.findTransformedAncestor();
|
|
11253
|
+
const ancestorOffset = transformedAncestor ? transformedAncestor.getBoundingClientRect().left : 0;
|
|
11250
11254
|
console.log('🎯🎯🎯 [RECT FROM DIRECTIVE] 🎯🎯🎯', {
|
|
11251
11255
|
left: rect.left,
|
|
11252
11256
|
right: rect.right,
|
|
@@ -11255,7 +11259,9 @@ class TooltipContainerComponent {
|
|
|
11255
11259
|
width: rect.width,
|
|
11256
11260
|
height: rect.height,
|
|
11257
11261
|
x: rect.x,
|
|
11258
|
-
y: rect.y
|
|
11262
|
+
y: rect.y,
|
|
11263
|
+
ancestorOffset,
|
|
11264
|
+
transformedAncestor: transformedAncestor?.tagName
|
|
11259
11265
|
});
|
|
11260
11266
|
const position = this.tooltipPosition();
|
|
11261
11267
|
const mousePos = this.mousePosition();
|
|
@@ -11289,7 +11295,7 @@ class TooltipContainerComponent {
|
|
|
11289
11295
|
else if (leftPos + halfWidth > effectiveRight - padding) {
|
|
11290
11296
|
leftPos = effectiveRight - padding - halfWidth;
|
|
11291
11297
|
}
|
|
11292
|
-
return leftPos;
|
|
11298
|
+
return leftPos - ancestorOffset;
|
|
11293
11299
|
}
|
|
11294
11300
|
switch (position) {
|
|
11295
11301
|
case 'top':
|
|
@@ -11313,47 +11319,48 @@ class TooltipContainerComponent {
|
|
|
11313
11319
|
});
|
|
11314
11320
|
if (wouldGoOffLeft) {
|
|
11315
11321
|
// Align to left edge with padding
|
|
11316
|
-
const result = effectiveLeft + padding + halfWidth;
|
|
11317
|
-
console.log('⬅️ [Tooltip adjusting LEFT]', { result });
|
|
11322
|
+
const result = effectiveLeft + padding + halfWidth - ancestorOffset;
|
|
11323
|
+
console.log('⬅️ [Tooltip adjusting LEFT]', { result, ancestorOffset });
|
|
11318
11324
|
return result;
|
|
11319
11325
|
}
|
|
11320
11326
|
else if (wouldGoOffRight) {
|
|
11321
11327
|
// Align to right edge with padding
|
|
11322
|
-
const result = effectiveRight - padding - halfWidth;
|
|
11323
|
-
console.log('➡️ [Tooltip adjusting RIGHT]', { result });
|
|
11328
|
+
const result = effectiveRight - padding - halfWidth - ancestorOffset;
|
|
11329
|
+
console.log('➡️ [Tooltip adjusting RIGHT]', { result, ancestorOffset });
|
|
11324
11330
|
return result;
|
|
11325
11331
|
}
|
|
11326
11332
|
else {
|
|
11327
11333
|
// Center normally (transform will be applied)
|
|
11328
|
-
|
|
11329
|
-
|
|
11334
|
+
const result = centerPosition - ancestorOffset;
|
|
11335
|
+
console.log('🎯 [Tooltip centered]', { centerPosition, ancestorOffset, result });
|
|
11336
|
+
return result;
|
|
11330
11337
|
}
|
|
11331
11338
|
}
|
|
11332
11339
|
case 'left': {
|
|
11333
11340
|
const leftPosition = rect.left - tooltipWidth - 8;
|
|
11334
11341
|
// If tooltip would go off left edge, position it to the right instead
|
|
11335
11342
|
if (leftPosition < effectiveLeft + padding) {
|
|
11336
|
-
const result = rect.right + 8;
|
|
11337
|
-
console.log('⬅️➡️ [Tooltip LEFT flipped to RIGHT]', { leftPosition, result });
|
|
11343
|
+
const result = rect.right + 8 - ancestorOffset;
|
|
11344
|
+
console.log('⬅️➡️ [Tooltip LEFT flipped to RIGHT]', { leftPosition, result, ancestorOffset });
|
|
11338
11345
|
return result;
|
|
11339
11346
|
}
|
|
11340
|
-
console.log('⬅️ [Tooltip LEFT]', { leftPosition });
|
|
11341
|
-
return leftPosition;
|
|
11347
|
+
console.log('⬅️ [Tooltip LEFT]', { leftPosition, ancestorOffset });
|
|
11348
|
+
return leftPosition - ancestorOffset;
|
|
11342
11349
|
}
|
|
11343
11350
|
case 'right': {
|
|
11344
11351
|
const rightPosition = rect.right + 8;
|
|
11345
11352
|
// If tooltip would go off right edge, position it to the left instead
|
|
11346
11353
|
if (rightPosition + tooltipWidth > effectiveRight - padding) {
|
|
11347
|
-
const result = rect.left - tooltipWidth - 8;
|
|
11348
|
-
console.log('➡️⬅️ [Tooltip RIGHT flipped to LEFT]', { rightPosition, result });
|
|
11354
|
+
const result = rect.left - tooltipWidth - 8 - ancestorOffset;
|
|
11355
|
+
console.log('➡️⬅️ [Tooltip RIGHT flipped to LEFT]', { rightPosition, result, ancestorOffset });
|
|
11349
11356
|
return result;
|
|
11350
11357
|
}
|
|
11351
|
-
console.log('➡️ [Tooltip RIGHT]', { rightPosition });
|
|
11352
|
-
return rightPosition;
|
|
11358
|
+
console.log('➡️ [Tooltip RIGHT]', { rightPosition, ancestorOffset });
|
|
11359
|
+
return rightPosition - ancestorOffset;
|
|
11353
11360
|
}
|
|
11354
11361
|
default:
|
|
11355
|
-
const defaultResult = rect.left + rect.width / 2;
|
|
11356
|
-
console.log('🔄 [Tooltip DEFAULT]', { defaultResult });
|
|
11362
|
+
const defaultResult = rect.left + rect.width / 2 - ancestorOffset;
|
|
11363
|
+
console.log('🔄 [Tooltip DEFAULT]', { defaultResult, ancestorOffset });
|
|
11357
11364
|
return defaultResult;
|
|
11358
11365
|
}
|
|
11359
11366
|
}
|
|
@@ -11361,6 +11368,9 @@ class TooltipContainerComponent {
|
|
|
11361
11368
|
const rect = this.targetRect();
|
|
11362
11369
|
if (!rect)
|
|
11363
11370
|
return 0;
|
|
11371
|
+
// Find if there's a transformed ancestor that changes the positioning context
|
|
11372
|
+
const transformedAncestor = this.findTransformedAncestor();
|
|
11373
|
+
const ancestorOffset = transformedAncestor ? transformedAncestor.getBoundingClientRect().top : 0;
|
|
11364
11374
|
const position = this.tooltipPosition();
|
|
11365
11375
|
const mousePos = this.mousePosition();
|
|
11366
11376
|
const type = this.tooltipType();
|
|
@@ -11390,35 +11400,53 @@ class TooltipContainerComponent {
|
|
|
11390
11400
|
if (topPos < effectiveTop + padding) {
|
|
11391
11401
|
topPos = effectiveTop + padding;
|
|
11392
11402
|
}
|
|
11393
|
-
return topPos;
|
|
11403
|
+
return topPos - ancestorOffset;
|
|
11394
11404
|
}
|
|
11395
11405
|
switch (position) {
|
|
11396
11406
|
case 'top': {
|
|
11397
11407
|
const topPosition = rect.top - estimatedHeight - 8;
|
|
11398
11408
|
// If tooltip would go off top edge, position it below instead
|
|
11399
11409
|
if (topPosition < effectiveTop + padding) {
|
|
11400
|
-
return rect.bottom + 8;
|
|
11410
|
+
return rect.bottom + 8 - ancestorOffset;
|
|
11401
11411
|
}
|
|
11402
|
-
return topPosition;
|
|
11412
|
+
return topPosition - ancestorOffset;
|
|
11403
11413
|
}
|
|
11404
11414
|
case 'bottom': {
|
|
11405
11415
|
const bottomPosition = rect.bottom + 8;
|
|
11406
11416
|
// If tooltip would go off bottom edge, position it above instead
|
|
11407
11417
|
if (bottomPosition + estimatedHeight > effectiveBottom - padding) {
|
|
11408
|
-
return rect.top - estimatedHeight - 8;
|
|
11418
|
+
return rect.top - estimatedHeight - 8 - ancestorOffset;
|
|
11409
11419
|
}
|
|
11410
|
-
return bottomPosition;
|
|
11420
|
+
return bottomPosition - ancestorOffset;
|
|
11411
11421
|
}
|
|
11412
11422
|
case 'left':
|
|
11413
11423
|
case 'right': {
|
|
11414
11424
|
const centerPosition = rect.top + rect.height / 2 - estimatedHeight / 2;
|
|
11415
11425
|
// Keep within bounds
|
|
11416
11426
|
const maxTop = effectiveBottom - padding - estimatedHeight;
|
|
11417
|
-
return Math.max(effectiveTop + padding, Math.min(centerPosition, maxTop));
|
|
11427
|
+
return Math.max(effectiveTop + padding, Math.min(centerPosition, maxTop)) - ancestorOffset;
|
|
11418
11428
|
}
|
|
11419
11429
|
default:
|
|
11420
|
-
return rect.top - estimatedHeight - 8;
|
|
11430
|
+
return rect.top - estimatedHeight - 8 - ancestorOffset;
|
|
11431
|
+
}
|
|
11432
|
+
}
|
|
11433
|
+
findTransformedAncestor() {
|
|
11434
|
+
let element = this.elementRef.nativeElement.parentElement;
|
|
11435
|
+
while (element && element !== document.body) {
|
|
11436
|
+
const style = window.getComputedStyle(element);
|
|
11437
|
+
const transform = style.transform;
|
|
11438
|
+
// Check if element has any transform (including identity transforms like matrix3d)
|
|
11439
|
+
if (transform && transform !== 'none') {
|
|
11440
|
+
console.log('🔍 [Found transformed ancestor]', {
|
|
11441
|
+
tagName: element.tagName,
|
|
11442
|
+
transform,
|
|
11443
|
+
rect: element.getBoundingClientRect()
|
|
11444
|
+
});
|
|
11445
|
+
return element;
|
|
11446
|
+
}
|
|
11447
|
+
element = element.parentElement;
|
|
11421
11448
|
}
|
|
11449
|
+
return null;
|
|
11422
11450
|
}
|
|
11423
11451
|
static { this.ɵfac = function TooltipContainerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TooltipContainerComponent)(); }; }
|
|
11424
11452
|
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TooltipContainerComponent, selectors: [["symphiq-tooltip-container"]], hostVars: 2, hostBindings: function TooltipContainerComponent_HostBindings(rf, ctx) { if (rf & 2) {
|