@eric-emg/symphiq-components 1.2.80 → 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.
@@ -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,11 +11295,13 @@ 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':
11296
11302
  case 'bottom': {
11303
+ // rect.left is relative to viewport, so we don't need to adjust for viewportBounds
11304
+ // The tooltip is positioned fixed relative to the viewport too
11297
11305
  const centerPosition = rect.left + rect.width / 2;
11298
11306
  const halfWidth = tooltipWidth / 2;
11299
11307
  // Check if centered tooltip would go off bounds
@@ -11311,47 +11319,48 @@ class TooltipContainerComponent {
11311
11319
  });
11312
11320
  if (wouldGoOffLeft) {
11313
11321
  // Align to left edge with padding
11314
- const result = effectiveLeft + padding + halfWidth;
11315
- console.log('⬅️ [Tooltip adjusting LEFT]', { result });
11322
+ const result = effectiveLeft + padding + halfWidth - ancestorOffset;
11323
+ console.log('⬅️ [Tooltip adjusting LEFT]', { result, ancestorOffset });
11316
11324
  return result;
11317
11325
  }
11318
11326
  else if (wouldGoOffRight) {
11319
11327
  // Align to right edge with padding
11320
- const result = effectiveRight - padding - halfWidth;
11321
- console.log('➡️ [Tooltip adjusting RIGHT]', { result });
11328
+ const result = effectiveRight - padding - halfWidth - ancestorOffset;
11329
+ console.log('➡️ [Tooltip adjusting RIGHT]', { result, ancestorOffset });
11322
11330
  return result;
11323
11331
  }
11324
11332
  else {
11325
11333
  // Center normally (transform will be applied)
11326
- console.log('🎯 [Tooltip centered]', { centerPosition });
11327
- return centerPosition;
11334
+ const result = centerPosition - ancestorOffset;
11335
+ console.log('🎯 [Tooltip centered]', { centerPosition, ancestorOffset, result });
11336
+ return result;
11328
11337
  }
11329
11338
  }
11330
11339
  case 'left': {
11331
11340
  const leftPosition = rect.left - tooltipWidth - 8;
11332
11341
  // If tooltip would go off left edge, position it to the right instead
11333
11342
  if (leftPosition < effectiveLeft + padding) {
11334
- const result = rect.right + 8;
11335
- 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 });
11336
11345
  return result;
11337
11346
  }
11338
- console.log('⬅️ [Tooltip LEFT]', { leftPosition });
11339
- return leftPosition;
11347
+ console.log('⬅️ [Tooltip LEFT]', { leftPosition, ancestorOffset });
11348
+ return leftPosition - ancestorOffset;
11340
11349
  }
11341
11350
  case 'right': {
11342
11351
  const rightPosition = rect.right + 8;
11343
11352
  // If tooltip would go off right edge, position it to the left instead
11344
11353
  if (rightPosition + tooltipWidth > effectiveRight - padding) {
11345
- const result = rect.left - tooltipWidth - 8;
11346
- 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 });
11347
11356
  return result;
11348
11357
  }
11349
- console.log('➡️ [Tooltip RIGHT]', { rightPosition });
11350
- return rightPosition;
11358
+ console.log('➡️ [Tooltip RIGHT]', { rightPosition, ancestorOffset });
11359
+ return rightPosition - ancestorOffset;
11351
11360
  }
11352
11361
  default:
11353
- const defaultResult = rect.left + rect.width / 2;
11354
- console.log('🔄 [Tooltip DEFAULT]', { defaultResult });
11362
+ const defaultResult = rect.left + rect.width / 2 - ancestorOffset;
11363
+ console.log('🔄 [Tooltip DEFAULT]', { defaultResult, ancestorOffset });
11355
11364
  return defaultResult;
11356
11365
  }
11357
11366
  }
@@ -11359,6 +11368,9 @@ class TooltipContainerComponent {
11359
11368
  const rect = this.targetRect();
11360
11369
  if (!rect)
11361
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;
11362
11374
  const position = this.tooltipPosition();
11363
11375
  const mousePos = this.mousePosition();
11364
11376
  const type = this.tooltipType();
@@ -11388,35 +11400,53 @@ class TooltipContainerComponent {
11388
11400
  if (topPos < effectiveTop + padding) {
11389
11401
  topPos = effectiveTop + padding;
11390
11402
  }
11391
- return topPos;
11403
+ return topPos - ancestorOffset;
11392
11404
  }
11393
11405
  switch (position) {
11394
11406
  case 'top': {
11395
11407
  const topPosition = rect.top - estimatedHeight - 8;
11396
11408
  // If tooltip would go off top edge, position it below instead
11397
11409
  if (topPosition < effectiveTop + padding) {
11398
- return rect.bottom + 8;
11410
+ return rect.bottom + 8 - ancestorOffset;
11399
11411
  }
11400
- return topPosition;
11412
+ return topPosition - ancestorOffset;
11401
11413
  }
11402
11414
  case 'bottom': {
11403
11415
  const bottomPosition = rect.bottom + 8;
11404
11416
  // If tooltip would go off bottom edge, position it above instead
11405
11417
  if (bottomPosition + estimatedHeight > effectiveBottom - padding) {
11406
- return rect.top - estimatedHeight - 8;
11418
+ return rect.top - estimatedHeight - 8 - ancestorOffset;
11407
11419
  }
11408
- return bottomPosition;
11420
+ return bottomPosition - ancestorOffset;
11409
11421
  }
11410
11422
  case 'left':
11411
11423
  case 'right': {
11412
11424
  const centerPosition = rect.top + rect.height / 2 - estimatedHeight / 2;
11413
11425
  // Keep within bounds
11414
11426
  const maxTop = effectiveBottom - padding - estimatedHeight;
11415
- return Math.max(effectiveTop + padding, Math.min(centerPosition, maxTop));
11427
+ return Math.max(effectiveTop + padding, Math.min(centerPosition, maxTop)) - ancestorOffset;
11416
11428
  }
11417
11429
  default:
11418
- 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;
11419
11448
  }
11449
+ return null;
11420
11450
  }
11421
11451
  static { this.ɵfac = function TooltipContainerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || TooltipContainerComponent)(); }; }
11422
11452
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TooltipContainerComponent, selectors: [["symphiq-tooltip-container"]], hostVars: 2, hostBindings: function TooltipContainerComponent_HostBindings(rf, ctx) { if (rf & 2) {