@fluid-topics/ft-tooltip 1.3.61 → 1.3.62
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/build/ft-tooltip.js +17 -13
- package/build/ft-tooltip.light.js +76 -74
- package/build/ft-tooltip.min.js +80 -78
- package/build/ft-tooltip.styles.d.ts +0 -1
- package/build/ft-tooltip.styles.js +5 -4
- package/package.json +5 -5
package/build/ft-tooltip.js
CHANGED
|
@@ -4,13 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
8
|
-
import { property, query, queryAssignedNodes, state } from "lit/decorators.js";
|
|
9
|
-
import { Debouncer, designSystemVariables, eventPathContainsMatchingElement, jsonProperty, numberProperty } from "@fluid-topics/ft-wc-utils";
|
|
10
|
-
import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
7
|
+
import { html, } from "lit";
|
|
8
|
+
import { property, query, queryAssignedNodes, state, } from "lit/decorators.js";
|
|
9
|
+
import { Debouncer, designSystemVariables, eventPathContainsMatchingElement, jsonProperty, numberProperty, } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
11
11
|
import { styles } from "./ft-tooltip.styles";
|
|
12
12
|
import { computeOffsetPosition } from "@fluid-topics/ft-wc-utils/build/floating";
|
|
13
|
-
import { i18nAttribute } from "@fluid-topics/ft-i18n/build/decorators/i18nAttribute";
|
|
13
|
+
import { i18nAttribute, } from "@fluid-topics/ft-i18n/build/decorators/i18nAttribute";
|
|
14
14
|
import { FtLitElementWithI18n } from "@fluid-topics/ft-i18n";
|
|
15
15
|
class FtTooltip extends FtLitElementWithI18n {
|
|
16
16
|
constructor() {
|
|
@@ -68,7 +68,7 @@ class FtTooltip extends FtLitElementWithI18n {
|
|
|
68
68
|
<slot part="slot"></slot>
|
|
69
69
|
<div part="tooltip" role="tooltip" inert
|
|
70
70
|
class="ft-tooltip ft-tooltip--${this.validPosition}"
|
|
71
|
-
|
|
71
|
+
popover="manual">
|
|
72
72
|
<div part="tooltip-content" class="ft-tooltip--content">
|
|
73
73
|
<slot name="text"></slot>
|
|
74
74
|
<ft-typography variant="${FtTypographyVariants.caption}" ?hidden=${!((_a = this.text) === null || _a === void 0 ? void 0 : _a.message)}>
|
|
@@ -108,8 +108,15 @@ class FtTooltip extends FtLitElementWithI18n {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
updated(props) {
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
var _a, _b;
|
|
112
|
+
if (props.has("visible")) {
|
|
113
|
+
if (this.visible) {
|
|
114
|
+
this.resetTooltipContent();
|
|
115
|
+
(_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.showPopover();
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
(_b = this.tooltip) === null || _b === void 0 ? void 0 : _b.hidePopover();
|
|
119
|
+
}
|
|
113
120
|
}
|
|
114
121
|
super.updated(props);
|
|
115
122
|
}
|
|
@@ -188,13 +195,10 @@ class FtTooltip extends FtLitElementWithI18n {
|
|
|
188
195
|
positionTooltip() {
|
|
189
196
|
this.resetTooltipContent();
|
|
190
197
|
if (this.tooltip && this.slottedElement) {
|
|
191
|
-
this.tooltip.
|
|
192
|
-
this.tooltip.style.top = "";
|
|
193
|
-
computeOffsetPosition(this.slottedElement, this.tooltip, this.position)
|
|
198
|
+
computeOffsetPosition(this.slottedElement, this.tooltip, { placement: this.position, strategy: "fixed" })
|
|
194
199
|
.then(({ x, y }) => {
|
|
195
200
|
if (this.tooltip) {
|
|
196
|
-
this.tooltip.style.
|
|
197
|
-
this.tooltip.style.top = `${y}px`;
|
|
201
|
+
this.tooltip.style.transform = `translate(${x}px,${y}px)`;
|
|
198
202
|
}
|
|
199
203
|
});
|
|
200
204
|
}
|