@scania/tegel 1.25.0-tooltip-beta.0 → 1.26.0

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.
@@ -1,319 +0,0 @@
1
- import { h, Host } from "@stencil/core";
2
- export class TdsTooltipBeta {
3
- constructor() {
4
- this.debounce = (func, delay) => (...args) => {
5
- let debounceTimer;
6
- clearTimeout(debounceTimer);
7
- debounceTimer = setTimeout(() => func.apply(this, args), delay);
8
- };
9
- this.showTooltip = this.debounce(() => {
10
- this.isVisible = true;
11
- this.updateTooltipPosition();
12
- }, 100);
13
- this.hideTooltip = this.debounce(() => {
14
- this.isVisible = false;
15
- }, 100);
16
- this.toggleTooltip = () => {
17
- this.isVisible = !this.isVisible;
18
- this.updateTooltipPosition();
19
- };
20
- this.setTooltipRef = (element) => {
21
- this.tooltipEl = element;
22
- };
23
- this.text = '';
24
- this.selector = undefined;
25
- this.referenceEl = undefined;
26
- this.defaultShow = false;
27
- this.mouseOverTooltip = false;
28
- this.trigger = 'hover';
29
- this.show = null;
30
- this.placement = 'bottom';
31
- this.offsetSkidding = 0;
32
- this.offsetDistance = 8;
33
- this.isVisible = this.defaultShow;
34
- }
35
- componentDidLoad() {
36
- if (!this.referenceEl && this.selector) {
37
- this.referenceEl = document.querySelector(this.selector);
38
- }
39
- if (this.referenceEl) {
40
- this.bindEvents();
41
- }
42
- }
43
- connectedCallback() {
44
- this.resizeObserver = new ResizeObserver(() => this.updateTooltipPosition());
45
- if (this.referenceEl) {
46
- this.resizeObserver.observe(this.referenceEl);
47
- }
48
- window.addEventListener('resize', this.updateTooltipPosition);
49
- }
50
- disconnectedCallback() {
51
- this.resizeObserver.disconnect();
52
- window.removeEventListener('resize', this.updateTooltipPosition);
53
- }
54
- bindEvents() {
55
- var _a, _b;
56
- if (this.trigger === 'hover') {
57
- this.referenceEl.addEventListener('mouseenter', this.showTooltip);
58
- this.referenceEl.addEventListener('mouseleave', this.hideTooltip);
59
- if (this.mouseOverTooltip) {
60
- (_a = this.tooltipEl) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.showTooltip);
61
- (_b = this.tooltipEl) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.hideTooltip);
62
- }
63
- }
64
- else if (this.trigger === 'click') {
65
- this.referenceEl.addEventListener('click', this.toggleTooltip);
66
- }
67
- }
68
- updateTooltipPosition() {
69
- if (!this.tooltipEl || !this.referenceEl)
70
- return;
71
- requestAnimationFrame(() => {
72
- const rect = this.referenceEl.getBoundingClientRect();
73
- const { height, width, bottom } = rect;
74
- let { top, left } = rect;
75
- switch (this.placement) {
76
- case 'top':
77
- top -= this.tooltipEl.offsetHeight + this.offsetDistance;
78
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
79
- break;
80
- case 'bottom':
81
- top += height + this.offsetDistance;
82
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
83
- break;
84
- case 'left':
85
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
86
- left -= this.tooltipEl.offsetWidth + this.offsetDistance;
87
- break;
88
- case 'right':
89
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
90
- left += width + this.offsetDistance;
91
- break;
92
- // Handle more complex placements like 'top-start', 'bottom-end', etc.
93
- default:
94
- top = bottom + this.offsetDistance;
95
- left = left + width / 2 - this.tooltipEl.offsetWidth / 2;
96
- break;
97
- }
98
- // Additional offsets
99
- left += this.offsetSkidding;
100
- this.tooltipEl.style.top = `${top}px`;
101
- this.tooltipEl.style.left = `${left}px`;
102
- });
103
- }
104
- render() {
105
- return (h(Host, { key: 'ccab2630363c007e8d4719d22ab140e80547251b' }, h("div", { key: '3c64224e0620e60f42089205e3ca8d0766df90cc', class: {
106
- 'tds-tooltip': true,
107
- 'tds-tooltip-show': this.isVisible,
108
- }, ref: this.setTooltipRef }, this.text, h("slot", { key: '4674e18dbf5bfe563ca3c01757280ccd660c5049' }))));
109
- }
110
- static get is() { return "tds-tooltip-beta"; }
111
- static get encapsulation() { return "scoped"; }
112
- static get originalStyleUrls() {
113
- return {
114
- "$": ["tooltip-beta.scss"]
115
- };
116
- }
117
- static get styleUrls() {
118
- return {
119
- "$": ["tooltip-beta.css"]
120
- };
121
- }
122
- static get properties() {
123
- return {
124
- "text": {
125
- "type": "string",
126
- "mutable": false,
127
- "complexType": {
128
- "original": "string",
129
- "resolved": "string",
130
- "references": {}
131
- },
132
- "required": false,
133
- "optional": false,
134
- "docs": {
135
- "tags": [],
136
- "text": ""
137
- },
138
- "attribute": "text",
139
- "reflect": false,
140
- "defaultValue": "''"
141
- },
142
- "selector": {
143
- "type": "string",
144
- "mutable": false,
145
- "complexType": {
146
- "original": "string",
147
- "resolved": "string",
148
- "references": {}
149
- },
150
- "required": false,
151
- "optional": false,
152
- "docs": {
153
- "tags": [],
154
- "text": ""
155
- },
156
- "attribute": "selector",
157
- "reflect": false
158
- },
159
- "referenceEl": {
160
- "type": "unknown",
161
- "mutable": false,
162
- "complexType": {
163
- "original": "HTMLElement | null",
164
- "resolved": "HTMLElement",
165
- "references": {
166
- "HTMLElement": {
167
- "location": "global",
168
- "id": "global::HTMLElement"
169
- }
170
- }
171
- },
172
- "required": false,
173
- "optional": true,
174
- "docs": {
175
- "tags": [],
176
- "text": ""
177
- }
178
- },
179
- "defaultShow": {
180
- "type": "boolean",
181
- "mutable": false,
182
- "complexType": {
183
- "original": "boolean",
184
- "resolved": "boolean",
185
- "references": {}
186
- },
187
- "required": false,
188
- "optional": false,
189
- "docs": {
190
- "tags": [],
191
- "text": ""
192
- },
193
- "attribute": "default-show",
194
- "reflect": false,
195
- "defaultValue": "false"
196
- },
197
- "mouseOverTooltip": {
198
- "type": "boolean",
199
- "mutable": false,
200
- "complexType": {
201
- "original": "boolean",
202
- "resolved": "boolean",
203
- "references": {}
204
- },
205
- "required": false,
206
- "optional": false,
207
- "docs": {
208
- "tags": [],
209
- "text": ""
210
- },
211
- "attribute": "mouse-over-tooltip",
212
- "reflect": false,
213
- "defaultValue": "false"
214
- },
215
- "trigger": {
216
- "type": "string",
217
- "mutable": false,
218
- "complexType": {
219
- "original": "'click' | 'hover'",
220
- "resolved": "\"click\" | \"hover\"",
221
- "references": {}
222
- },
223
- "required": false,
224
- "optional": false,
225
- "docs": {
226
- "tags": [],
227
- "text": ""
228
- },
229
- "attribute": "trigger",
230
- "reflect": false,
231
- "defaultValue": "'hover'"
232
- },
233
- "show": {
234
- "type": "boolean",
235
- "mutable": true,
236
- "complexType": {
237
- "original": "boolean",
238
- "resolved": "boolean",
239
- "references": {}
240
- },
241
- "required": false,
242
- "optional": false,
243
- "docs": {
244
- "tags": [],
245
- "text": ""
246
- },
247
- "attribute": "show",
248
- "reflect": false,
249
- "defaultValue": "null"
250
- },
251
- "placement": {
252
- "type": "string",
253
- "mutable": false,
254
- "complexType": {
255
- "original": "Placement",
256
- "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
257
- "references": {
258
- "Placement": {
259
- "location": "import",
260
- "path": "../../types/Tooltip",
261
- "id": "src/types/Tooltip.ts::Placement"
262
- }
263
- }
264
- },
265
- "required": false,
266
- "optional": false,
267
- "docs": {
268
- "tags": [],
269
- "text": ""
270
- },
271
- "attribute": "placement",
272
- "reflect": false,
273
- "defaultValue": "'bottom'"
274
- },
275
- "offsetSkidding": {
276
- "type": "number",
277
- "mutable": false,
278
- "complexType": {
279
- "original": "number",
280
- "resolved": "number",
281
- "references": {}
282
- },
283
- "required": false,
284
- "optional": false,
285
- "docs": {
286
- "tags": [],
287
- "text": ""
288
- },
289
- "attribute": "offset-skidding",
290
- "reflect": false,
291
- "defaultValue": "0"
292
- },
293
- "offsetDistance": {
294
- "type": "number",
295
- "mutable": false,
296
- "complexType": {
297
- "original": "number",
298
- "resolved": "number",
299
- "references": {}
300
- },
301
- "required": false,
302
- "optional": false,
303
- "docs": {
304
- "tags": [],
305
- "text": ""
306
- },
307
- "attribute": "offset-distance",
308
- "reflect": false,
309
- "defaultValue": "8"
310
- }
311
- };
312
- }
313
- static get states() {
314
- return {
315
- "isVisible": {}
316
- };
317
- }
318
- static get elementRef() { return "host"; }
319
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import type { Components, JSX } from "../types/components";
2
-
3
- interface TdsTooltipBeta extends Components.TdsTooltipBeta, HTMLElement {}
4
- export const TdsTooltipBeta: {
5
- prototype: TdsTooltipBeta;
6
- new (): TdsTooltipBeta;
7
- };
8
- /**
9
- * Used to define this component and all nested components recursively.
10
- */
11
- export const defineCustomElement: () => void;
@@ -1,149 +0,0 @@
1
- import { p as proxyCustomElement, H, h, c as Host } from './p-28ef5186.js';
2
-
3
- const tooltipBetaCss = ".sc-tds-tooltip-beta-h{position:absolute}.tds-tooltip.sc-tds-tooltip-beta{box-sizing:border-box;font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-tooltip-color);background-color:var(--tds-tooltip-background);border-radius:4px;padding:8px;word-wrap:break-word;white-space:normal;max-width:192px;z-index:900;opacity:0;visibility:hidden;transition:opacity 200ms ease-in, visibility 200ms ease-in}.tds-tooltip.sc-tds-tooltip-beta *.sc-tds-tooltip-beta{box-sizing:border-box}.tds-tooltip.tds-tooltip-top-left.sc-tds-tooltip-beta{border-radius:0 4px 4px}.tds-tooltip.tds-tooltip-top-right.sc-tds-tooltip-beta{border-radius:4px 0 4px 4px}.tds-tooltip.tds-tooltip-bottom-right.sc-tds-tooltip-beta{border-radius:4px 4px 0}.tds-tooltip.tds-tooltip-bottom-left.sc-tds-tooltip-beta{border-radius:4px 4px 4px 0}.tds-tooltip-show.sc-tds-tooltip-beta{opacity:1;visibility:visible}";
4
- const TdsTooltipBetaStyle0 = tooltipBetaCss;
5
-
6
- const TdsTooltipBeta$1 = /*@__PURE__*/ proxyCustomElement(class TdsTooltipBeta extends H {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.debounce = (func, delay) => (...args) => {
11
- let debounceTimer;
12
- clearTimeout(debounceTimer);
13
- debounceTimer = setTimeout(() => func.apply(this, args), delay);
14
- };
15
- this.showTooltip = this.debounce(() => {
16
- this.isVisible = true;
17
- this.updateTooltipPosition();
18
- }, 100);
19
- this.hideTooltip = this.debounce(() => {
20
- this.isVisible = false;
21
- }, 100);
22
- this.toggleTooltip = () => {
23
- this.isVisible = !this.isVisible;
24
- this.updateTooltipPosition();
25
- };
26
- this.setTooltipRef = (element) => {
27
- this.tooltipEl = element;
28
- };
29
- this.text = '';
30
- this.selector = undefined;
31
- this.referenceEl = undefined;
32
- this.defaultShow = false;
33
- this.mouseOverTooltip = false;
34
- this.trigger = 'hover';
35
- this.show = null;
36
- this.placement = 'bottom';
37
- this.offsetSkidding = 0;
38
- this.offsetDistance = 8;
39
- this.isVisible = this.defaultShow;
40
- }
41
- componentDidLoad() {
42
- if (!this.referenceEl && this.selector) {
43
- this.referenceEl = document.querySelector(this.selector);
44
- }
45
- if (this.referenceEl) {
46
- this.bindEvents();
47
- }
48
- }
49
- connectedCallback() {
50
- this.resizeObserver = new ResizeObserver(() => this.updateTooltipPosition());
51
- if (this.referenceEl) {
52
- this.resizeObserver.observe(this.referenceEl);
53
- }
54
- window.addEventListener('resize', this.updateTooltipPosition);
55
- }
56
- disconnectedCallback() {
57
- this.resizeObserver.disconnect();
58
- window.removeEventListener('resize', this.updateTooltipPosition);
59
- }
60
- bindEvents() {
61
- var _a, _b;
62
- if (this.trigger === 'hover') {
63
- this.referenceEl.addEventListener('mouseenter', this.showTooltip);
64
- this.referenceEl.addEventListener('mouseleave', this.hideTooltip);
65
- if (this.mouseOverTooltip) {
66
- (_a = this.tooltipEl) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.showTooltip);
67
- (_b = this.tooltipEl) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.hideTooltip);
68
- }
69
- }
70
- else if (this.trigger === 'click') {
71
- this.referenceEl.addEventListener('click', this.toggleTooltip);
72
- }
73
- }
74
- updateTooltipPosition() {
75
- if (!this.tooltipEl || !this.referenceEl)
76
- return;
77
- requestAnimationFrame(() => {
78
- const rect = this.referenceEl.getBoundingClientRect();
79
- const { height, width, bottom } = rect;
80
- let { top, left } = rect;
81
- switch (this.placement) {
82
- case 'top':
83
- top -= this.tooltipEl.offsetHeight + this.offsetDistance;
84
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
85
- break;
86
- case 'bottom':
87
- top += height + this.offsetDistance;
88
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
89
- break;
90
- case 'left':
91
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
92
- left -= this.tooltipEl.offsetWidth + this.offsetDistance;
93
- break;
94
- case 'right':
95
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
96
- left += width + this.offsetDistance;
97
- break;
98
- // Handle more complex placements like 'top-start', 'bottom-end', etc.
99
- default:
100
- top = bottom + this.offsetDistance;
101
- left = left + width / 2 - this.tooltipEl.offsetWidth / 2;
102
- break;
103
- }
104
- // Additional offsets
105
- left += this.offsetSkidding;
106
- this.tooltipEl.style.top = `${top}px`;
107
- this.tooltipEl.style.left = `${left}px`;
108
- });
109
- }
110
- render() {
111
- return (h(Host, { key: 'ccab2630363c007e8d4719d22ab140e80547251b' }, h("div", { key: '3c64224e0620e60f42089205e3ca8d0766df90cc', class: {
112
- 'tds-tooltip': true,
113
- 'tds-tooltip-show': this.isVisible,
114
- }, ref: this.setTooltipRef }, this.text, h("slot", { key: '4674e18dbf5bfe563ca3c01757280ccd660c5049' }))));
115
- }
116
- get host() { return this; }
117
- static get style() { return TdsTooltipBetaStyle0; }
118
- }, [6, "tds-tooltip-beta", {
119
- "text": [1],
120
- "selector": [1],
121
- "referenceEl": [16],
122
- "defaultShow": [4, "default-show"],
123
- "mouseOverTooltip": [4, "mouse-over-tooltip"],
124
- "trigger": [1],
125
- "show": [1028],
126
- "placement": [1],
127
- "offsetSkidding": [2, "offset-skidding"],
128
- "offsetDistance": [2, "offset-distance"],
129
- "isVisible": [32]
130
- }]);
131
- function defineCustomElement$1() {
132
- if (typeof customElements === "undefined") {
133
- return;
134
- }
135
- const components = ["tds-tooltip-beta"];
136
- components.forEach(tagName => { switch (tagName) {
137
- case "tds-tooltip-beta":
138
- if (!customElements.get(tagName)) {
139
- customElements.define(tagName, TdsTooltipBeta$1);
140
- }
141
- break;
142
- } });
143
- }
144
- defineCustomElement$1();
145
-
146
- const TdsTooltipBeta = TdsTooltipBeta$1;
147
- const defineCustomElement = defineCustomElement$1;
148
-
149
- export { TdsTooltipBeta, defineCustomElement };
@@ -1,119 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-51d04e39.js';
2
-
3
- const tooltipBetaCss = ".sc-tds-tooltip-beta-h{position:absolute}.tds-tooltip.sc-tds-tooltip-beta{box-sizing:border-box;font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-tooltip-color);background-color:var(--tds-tooltip-background);border-radius:4px;padding:8px;word-wrap:break-word;white-space:normal;max-width:192px;z-index:900;opacity:0;visibility:hidden;transition:opacity 200ms ease-in, visibility 200ms ease-in}.tds-tooltip.sc-tds-tooltip-beta *.sc-tds-tooltip-beta{box-sizing:border-box}.tds-tooltip.tds-tooltip-top-left.sc-tds-tooltip-beta{border-radius:0 4px 4px}.tds-tooltip.tds-tooltip-top-right.sc-tds-tooltip-beta{border-radius:4px 0 4px 4px}.tds-tooltip.tds-tooltip-bottom-right.sc-tds-tooltip-beta{border-radius:4px 4px 0}.tds-tooltip.tds-tooltip-bottom-left.sc-tds-tooltip-beta{border-radius:4px 4px 4px 0}.tds-tooltip-show.sc-tds-tooltip-beta{opacity:1;visibility:visible}";
4
- const TdsTooltipBetaStyle0 = tooltipBetaCss;
5
-
6
- const TdsTooltipBeta = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.debounce = (func, delay) => (...args) => {
10
- let debounceTimer;
11
- clearTimeout(debounceTimer);
12
- debounceTimer = setTimeout(() => func.apply(this, args), delay);
13
- };
14
- this.showTooltip = this.debounce(() => {
15
- this.isVisible = true;
16
- this.updateTooltipPosition();
17
- }, 100);
18
- this.hideTooltip = this.debounce(() => {
19
- this.isVisible = false;
20
- }, 100);
21
- this.toggleTooltip = () => {
22
- this.isVisible = !this.isVisible;
23
- this.updateTooltipPosition();
24
- };
25
- this.setTooltipRef = (element) => {
26
- this.tooltipEl = element;
27
- };
28
- this.text = '';
29
- this.selector = undefined;
30
- this.referenceEl = undefined;
31
- this.defaultShow = false;
32
- this.mouseOverTooltip = false;
33
- this.trigger = 'hover';
34
- this.show = null;
35
- this.placement = 'bottom';
36
- this.offsetSkidding = 0;
37
- this.offsetDistance = 8;
38
- this.isVisible = this.defaultShow;
39
- }
40
- componentDidLoad() {
41
- if (!this.referenceEl && this.selector) {
42
- this.referenceEl = document.querySelector(this.selector);
43
- }
44
- if (this.referenceEl) {
45
- this.bindEvents();
46
- }
47
- }
48
- connectedCallback() {
49
- this.resizeObserver = new ResizeObserver(() => this.updateTooltipPosition());
50
- if (this.referenceEl) {
51
- this.resizeObserver.observe(this.referenceEl);
52
- }
53
- window.addEventListener('resize', this.updateTooltipPosition);
54
- }
55
- disconnectedCallback() {
56
- this.resizeObserver.disconnect();
57
- window.removeEventListener('resize', this.updateTooltipPosition);
58
- }
59
- bindEvents() {
60
- var _a, _b;
61
- if (this.trigger === 'hover') {
62
- this.referenceEl.addEventListener('mouseenter', this.showTooltip);
63
- this.referenceEl.addEventListener('mouseleave', this.hideTooltip);
64
- if (this.mouseOverTooltip) {
65
- (_a = this.tooltipEl) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.showTooltip);
66
- (_b = this.tooltipEl) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.hideTooltip);
67
- }
68
- }
69
- else if (this.trigger === 'click') {
70
- this.referenceEl.addEventListener('click', this.toggleTooltip);
71
- }
72
- }
73
- updateTooltipPosition() {
74
- if (!this.tooltipEl || !this.referenceEl)
75
- return;
76
- requestAnimationFrame(() => {
77
- const rect = this.referenceEl.getBoundingClientRect();
78
- const { height, width, bottom } = rect;
79
- let { top, left } = rect;
80
- switch (this.placement) {
81
- case 'top':
82
- top -= this.tooltipEl.offsetHeight + this.offsetDistance;
83
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
84
- break;
85
- case 'bottom':
86
- top += height + this.offsetDistance;
87
- left += width / 2 - this.tooltipEl.offsetWidth / 2;
88
- break;
89
- case 'left':
90
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
91
- left -= this.tooltipEl.offsetWidth + this.offsetDistance;
92
- break;
93
- case 'right':
94
- top += height / 2 - this.tooltipEl.offsetHeight / 2;
95
- left += width + this.offsetDistance;
96
- break;
97
- // Handle more complex placements like 'top-start', 'bottom-end', etc.
98
- default:
99
- top = bottom + this.offsetDistance;
100
- left = left + width / 2 - this.tooltipEl.offsetWidth / 2;
101
- break;
102
- }
103
- // Additional offsets
104
- left += this.offsetSkidding;
105
- this.tooltipEl.style.top = `${top}px`;
106
- this.tooltipEl.style.left = `${left}px`;
107
- });
108
- }
109
- render() {
110
- return (h(Host, { key: 'ccab2630363c007e8d4719d22ab140e80547251b' }, h("div", { key: '3c64224e0620e60f42089205e3ca8d0766df90cc', class: {
111
- 'tds-tooltip': true,
112
- 'tds-tooltip-show': this.isVisible,
113
- }, ref: this.setTooltipRef }, this.text, h("slot", { key: '4674e18dbf5bfe563ca3c01757280ccd660c5049' }))));
114
- }
115
- get host() { return getElement(this); }
116
- };
117
- TdsTooltipBeta.style = TdsTooltipBetaStyle0;
118
-
119
- export { TdsTooltipBeta as tds_tooltip_beta };
@@ -1 +0,0 @@
1
- import{r as t,h as i,H as s,g as o}from"./p-2049fab2.js";const e=class{constructor(i){t(this,i),this.debounce=(t,i)=>(...s)=>{let o;clearTimeout(o),o=setTimeout((()=>t.apply(this,s)),i)},this.showTooltip=this.debounce((()=>{this.isVisible=!0,this.updateTooltipPosition()}),100),this.hideTooltip=this.debounce((()=>{this.isVisible=!1}),100),this.toggleTooltip=()=>{this.isVisible=!this.isVisible,this.updateTooltipPosition()},this.setTooltipRef=t=>{this.tooltipEl=t},this.text="",this.selector=void 0,this.referenceEl=void 0,this.defaultShow=!1,this.mouseOverTooltip=!1,this.trigger="hover",this.show=null,this.placement="bottom",this.offsetSkidding=0,this.offsetDistance=8,this.isVisible=this.defaultShow}componentDidLoad(){!this.referenceEl&&this.selector&&(this.referenceEl=document.querySelector(this.selector)),this.referenceEl&&this.bindEvents()}connectedCallback(){this.resizeObserver=new ResizeObserver((()=>this.updateTooltipPosition())),this.referenceEl&&this.resizeObserver.observe(this.referenceEl),window.addEventListener("resize",this.updateTooltipPosition)}disconnectedCallback(){this.resizeObserver.disconnect(),window.removeEventListener("resize",this.updateTooltipPosition)}bindEvents(){var t,i;"hover"===this.trigger?(this.referenceEl.addEventListener("mouseenter",this.showTooltip),this.referenceEl.addEventListener("mouseleave",this.hideTooltip),this.mouseOverTooltip&&(null===(t=this.tooltipEl)||void 0===t||t.addEventListener("mouseenter",this.showTooltip),null===(i=this.tooltipEl)||void 0===i||i.addEventListener("mouseleave",this.hideTooltip))):"click"===this.trigger&&this.referenceEl.addEventListener("click",this.toggleTooltip)}updateTooltipPosition(){this.tooltipEl&&this.referenceEl&&requestAnimationFrame((()=>{const t=this.referenceEl.getBoundingClientRect(),{height:i,width:s,bottom:o}=t;let{top:e,left:h}=t;switch(this.placement){case"top":e-=this.tooltipEl.offsetHeight+this.offsetDistance,h+=s/2-this.tooltipEl.offsetWidth/2;break;case"bottom":e+=i+this.offsetDistance,h+=s/2-this.tooltipEl.offsetWidth/2;break;case"left":e+=i/2-this.tooltipEl.offsetHeight/2,h-=this.tooltipEl.offsetWidth+this.offsetDistance;break;case"right":e+=i/2-this.tooltipEl.offsetHeight/2,h+=s+this.offsetDistance;break;default:e=o+this.offsetDistance,h=h+s/2-this.tooltipEl.offsetWidth/2}h+=this.offsetSkidding,this.tooltipEl.style.top=`${e}px`,this.tooltipEl.style.left=`${h}px`}))}render(){return i(s,{key:"ccab2630363c007e8d4719d22ab140e80547251b"},i("div",{key:"3c64224e0620e60f42089205e3ca8d0766df90cc",class:{"tds-tooltip":!0,"tds-tooltip-show":this.isVisible},ref:this.setTooltipRef},this.text,i("slot",{key:"4674e18dbf5bfe563ca3c01757280ccd660c5049"})))}get host(){return o(this)}};e.style=".sc-tds-tooltip-beta-h{position:absolute}.tds-tooltip.sc-tds-tooltip-beta{box-sizing:border-box;font:var(--tds-detail-05);letter-spacing:var(--tds-detail-05-ls);color:var(--tds-tooltip-color);background-color:var(--tds-tooltip-background);border-radius:4px;padding:8px;word-wrap:break-word;white-space:normal;max-width:192px;z-index:900;opacity:0;visibility:hidden;transition:opacity 200ms ease-in, visibility 200ms ease-in}.tds-tooltip.sc-tds-tooltip-beta *.sc-tds-tooltip-beta{box-sizing:border-box}.tds-tooltip.tds-tooltip-top-left.sc-tds-tooltip-beta{border-radius:0 4px 4px}.tds-tooltip.tds-tooltip-top-right.sc-tds-tooltip-beta{border-radius:4px 0 4px 4px}.tds-tooltip.tds-tooltip-bottom-right.sc-tds-tooltip-beta{border-radius:4px 4px 0}.tds-tooltip.tds-tooltip-bottom-left.sc-tds-tooltip-beta{border-radius:4px 4px 4px 0}.tds-tooltip-show.sc-tds-tooltip-beta{opacity:1;visibility:visible}";export{e as tds_tooltip_beta}
@@ -1,28 +0,0 @@
1
- import { Placement } from '../../types/Tooltip';
2
- export declare class TdsTooltipBeta {
3
- host: HTMLElement;
4
- text: string;
5
- selector: string;
6
- referenceEl?: HTMLElement | null;
7
- defaultShow: boolean;
8
- mouseOverTooltip: boolean;
9
- trigger: 'click' | 'hover';
10
- show: boolean;
11
- placement: Placement;
12
- offsetSkidding: number;
13
- offsetDistance: number;
14
- isVisible: boolean;
15
- private tooltipEl;
16
- private resizeObserver;
17
- componentDidLoad(): void;
18
- connectedCallback(): void;
19
- disconnectedCallback(): void;
20
- private bindEvents;
21
- private debounce;
22
- private showTooltip;
23
- private hideTooltip;
24
- private toggleTooltip;
25
- private updateTooltipPosition;
26
- private setTooltipRef;
27
- render(): any;
28
- }
@@ -1,4 +0,0 @@
1
- type BasePlacement = 'top' | 'bottom' | 'left' | 'right';
2
- type VariationPlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
3
- export type Placement = BasePlacement | VariationPlacement;
4
- export {};