@rogieking/figui3 1.8.8 → 1.8.9
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/components.css +5 -3
- package/example.html +6 -0
- package/fig.js +8 -0
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -875,7 +875,7 @@ fig-button {
|
|
|
875
875
|
*[fill] {
|
|
876
876
|
fill: currentColor;
|
|
877
877
|
}
|
|
878
|
-
*[stroke][stroke
|
|
878
|
+
*[stroke]:not([stroke="none"]) {
|
|
879
879
|
stroke: currentColor;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
@@ -2085,7 +2085,7 @@ fig-popover {
|
|
|
2085
2085
|
height: 6px;
|
|
2086
2086
|
position: absolute;
|
|
2087
2087
|
top: calc(100% - 1px);
|
|
2088
|
-
left: 50
|
|
2088
|
+
left: var(--beak-offset, 50%);
|
|
2089
2089
|
z-index: 2;
|
|
2090
2090
|
transform: translate(-50%);
|
|
2091
2091
|
}
|
|
@@ -2093,6 +2093,7 @@ fig-popover {
|
|
|
2093
2093
|
&[position="bottom"] {
|
|
2094
2094
|
&:after {
|
|
2095
2095
|
top: 1px;
|
|
2096
|
+
left: var(--beak-offset, 50%);
|
|
2096
2097
|
transform: translate(-50%, -100%) scaleY(-1);
|
|
2097
2098
|
}
|
|
2098
2099
|
}
|
|
@@ -2116,7 +2117,7 @@ fig-popover {
|
|
|
2116
2117
|
height: 6px;
|
|
2117
2118
|
position: absolute;
|
|
2118
2119
|
top: calc(100% - 1px);
|
|
2119
|
-
left: 50
|
|
2120
|
+
left: var(--beak-offset, 50%);
|
|
2120
2121
|
z-index: 2;
|
|
2121
2122
|
transform: translate(-50%);
|
|
2122
2123
|
}
|
|
@@ -2124,6 +2125,7 @@ fig-popover {
|
|
|
2124
2125
|
&[position="bottom"] {
|
|
2125
2126
|
&:after {
|
|
2126
2127
|
top: 1px;
|
|
2128
|
+
left: var(--beak-offset, 50%);
|
|
2127
2129
|
transform: translate(-50%, -100%) scaleY(-1);
|
|
2128
2130
|
}
|
|
2129
2131
|
}
|
package/example.html
CHANGED
package/fig.js
CHANGED
|
@@ -383,6 +383,14 @@ class FigTooltip extends HTMLElement {
|
|
|
383
383
|
left = window.innerWidth - popupRect.width - offset.right;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
// Calculate the center of the target element relative to the tooltip
|
|
387
|
+
const targetCenter = rect.left + rect.width / 2;
|
|
388
|
+
const tooltipLeft = left;
|
|
389
|
+
const beakOffset = targetCenter - tooltipLeft;
|
|
390
|
+
|
|
391
|
+
// Set the beak offset as a CSS custom property
|
|
392
|
+
this.popup.style.setProperty("--beak-offset", `${beakOffset}px`);
|
|
393
|
+
|
|
386
394
|
this.popup.style.top = `${top}px`;
|
|
387
395
|
this.popup.style.left = `${left}px`;
|
|
388
396
|
this.popup.style.opacity = "1";
|