minahil 0.1.20 → 0.1.21
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/minahil.mjs +43 -20
- package/fesm2022/minahil.mjs.map +1 -1
- package/package.json +2 -2
package/fesm2022/minahil.mjs
CHANGED
|
@@ -2413,7 +2413,7 @@ class BKTooltipDirective {
|
|
|
2413
2413
|
return !this.tooltipContent.trim();
|
|
2414
2414
|
}
|
|
2415
2415
|
else if (Array.isArray(this.tooltipContent)) {
|
|
2416
|
-
return this.tooltipContent.length === 0 || this.tooltipContent.every(line => !line.trim());
|
|
2416
|
+
return this.tooltipContent.length === 0 || this.tooltipContent.every((line) => !line.trim());
|
|
2417
2417
|
}
|
|
2418
2418
|
return true;
|
|
2419
2419
|
}
|
|
@@ -2423,7 +2423,9 @@ class BKTooltipDirective {
|
|
|
2423
2423
|
this.tooltipElement = this.renderer.createElement('div');
|
|
2424
2424
|
this.renderer.addClass(this.tooltipElement, 'bk-tooltip-content');
|
|
2425
2425
|
// Add content
|
|
2426
|
-
const contentLines = Array.isArray(this.tooltipContent)
|
|
2426
|
+
const contentLines = Array.isArray(this.tooltipContent)
|
|
2427
|
+
? this.tooltipContent
|
|
2428
|
+
: [this.tooltipContent];
|
|
2427
2429
|
contentLines.forEach((line) => {
|
|
2428
2430
|
const div = this.renderer.createElement('div');
|
|
2429
2431
|
this.renderer.addClass(div, 'text');
|
|
@@ -2457,37 +2459,38 @@ class BKTooltipDirective {
|
|
|
2457
2459
|
return;
|
|
2458
2460
|
const hostRect = this.el.nativeElement.getBoundingClientRect();
|
|
2459
2461
|
const tooltipRect = this.tooltipElement.getBoundingClientRect();
|
|
2460
|
-
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
2461
|
-
const scrollLeft = window.scrollX || document.documentElement.scrollLeft;
|
|
2462
2462
|
const triangle = this.tooltipElement.querySelector('.bk-tooltip-triangle');
|
|
2463
2463
|
const padding = 10;
|
|
2464
2464
|
let top = 0, left = 0;
|
|
2465
|
-
// Position logic
|
|
2465
|
+
// Position logic — using viewport-relative coords (getBoundingClientRect)
|
|
2466
|
+
// since the tooltip uses position: fixed (no scroll offset needed)
|
|
2466
2467
|
switch (this.tooltipPosition) {
|
|
2467
2468
|
case 'right':
|
|
2468
2469
|
case 'left':
|
|
2469
|
-
top = hostRect.top +
|
|
2470
|
-
left =
|
|
2471
|
-
|
|
2472
|
-
|
|
2470
|
+
top = hostRect.top + hostRect.height / 2;
|
|
2471
|
+
left =
|
|
2472
|
+
this.tooltipPosition === 'right'
|
|
2473
|
+
? hostRect.right + padding
|
|
2474
|
+
: hostRect.left - tooltipRect.width - padding;
|
|
2473
2475
|
// Auto flip if out of viewport
|
|
2474
2476
|
if (this.tooltipPosition === 'right' && left + tooltipRect.width > window.innerWidth) {
|
|
2475
|
-
left = hostRect.left
|
|
2477
|
+
left = hostRect.left - tooltipRect.width - padding;
|
|
2476
2478
|
}
|
|
2477
2479
|
else if (this.tooltipPosition === 'left' && left < 0) {
|
|
2478
|
-
left = hostRect.right +
|
|
2480
|
+
left = hostRect.right + padding;
|
|
2479
2481
|
}
|
|
2480
2482
|
this.setStyle(this.tooltipElement, {
|
|
2481
2483
|
transform: 'translateY(-50%)',
|
|
2482
2484
|
});
|
|
2483
|
-
this.setTriangleStyles(triangle, this.tooltipPosition, left < hostRect.left
|
|
2485
|
+
this.setTriangleStyles(triangle, this.tooltipPosition, left < hostRect.left);
|
|
2484
2486
|
break;
|
|
2485
2487
|
case 'top':
|
|
2486
2488
|
case 'bottom':
|
|
2487
|
-
left = hostRect.left +
|
|
2488
|
-
top =
|
|
2489
|
-
|
|
2490
|
-
|
|
2489
|
+
left = hostRect.left + hostRect.width / 2 - tooltipRect.width / 2;
|
|
2490
|
+
top =
|
|
2491
|
+
this.tooltipPosition === 'top'
|
|
2492
|
+
? hostRect.top - tooltipRect.height - padding
|
|
2493
|
+
: hostRect.bottom + padding;
|
|
2491
2494
|
// Prevent overflow
|
|
2492
2495
|
left = Math.max(10, Math.min(left, window.innerWidth - tooltipRect.width - 10));
|
|
2493
2496
|
this.setStyle(this.tooltipElement, {
|
|
@@ -2516,13 +2519,33 @@ class BKTooltipDirective {
|
|
|
2516
2519
|
switch (position) {
|
|
2517
2520
|
case 'right':
|
|
2518
2521
|
styles = flipped
|
|
2519
|
-
? {
|
|
2520
|
-
|
|
2522
|
+
? {
|
|
2523
|
+
left: '100%',
|
|
2524
|
+
top: '50%',
|
|
2525
|
+
transform: 'translateY(-50%) translateX(0)',
|
|
2526
|
+
borderColor: 'transparent transparent transparent #1a1a1a',
|
|
2527
|
+
}
|
|
2528
|
+
: {
|
|
2529
|
+
left: '-15px',
|
|
2530
|
+
top: '50%',
|
|
2531
|
+
transform: 'translateY(-50%)',
|
|
2532
|
+
borderColor: 'transparent #1a1a1a transparent transparent',
|
|
2533
|
+
};
|
|
2521
2534
|
break;
|
|
2522
2535
|
case 'left':
|
|
2523
2536
|
styles = flipped
|
|
2524
|
-
? {
|
|
2525
|
-
|
|
2537
|
+
? {
|
|
2538
|
+
left: '100%',
|
|
2539
|
+
top: '50%',
|
|
2540
|
+
transform: 'translateY(-50%) translateX(0)',
|
|
2541
|
+
borderColor: 'transparent transparent transparent #1a1a1a',
|
|
2542
|
+
}
|
|
2543
|
+
: {
|
|
2544
|
+
left: '-15px',
|
|
2545
|
+
top: '50%',
|
|
2546
|
+
transform: 'translateY(-50%)',
|
|
2547
|
+
borderColor: 'transparent #1a1a1a transparent transparent',
|
|
2548
|
+
};
|
|
2526
2549
|
break;
|
|
2527
2550
|
case 'top':
|
|
2528
2551
|
styles = {
|