@vaadin/tooltip 23.3.0-alpha2 → 23.3.0-alpha3
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/package.json +7 -7
- package/src/vaadin-tooltip.d.ts +1 -1
- package/src/vaadin-tooltip.js +221 -162
- package/theme/lumo/vaadin-tooltip-styles.js +2 -2
- package/web-types.json +4 -4
- package/web-types.lit.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tooltip",
|
|
3
|
-
"version": "23.3.0-
|
|
3
|
+
"version": "23.3.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/component-base": "23.3.0-
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "23.3.0-
|
|
40
|
-
"@vaadin/vaadin-material-styles": "23.3.0-
|
|
41
|
-
"@vaadin/vaadin-overlay": "23.3.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "23.3.0-
|
|
38
|
+
"@vaadin/component-base": "23.3.0-alpha3",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha3",
|
|
40
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha3",
|
|
41
|
+
"@vaadin/vaadin-overlay": "23.3.0-alpha3",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"web-types.json",
|
|
51
51
|
"web-types.lit.json"
|
|
52
52
|
],
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e86cd2abf3e28bade37711291331415d92c454ec"
|
|
54
54
|
}
|
package/src/vaadin-tooltip.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ declare class Tooltip extends ThemePropertyMixin(ElementMixin(HTMLElement)) {
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* The delay in milliseconds before the tooltip
|
|
89
|
-
* is opened on focus, when not in manual mode.
|
|
89
|
+
* is opened on keyboard focus, when not in manual mode.
|
|
90
90
|
* @attr {number} focus-delay
|
|
91
91
|
*/
|
|
92
92
|
focusDelay: number;
|
package/src/vaadin-tooltip.js
CHANGED
|
@@ -23,6 +23,174 @@ let warmedUp = false;
|
|
|
23
23
|
let warmUpTimeout = null;
|
|
24
24
|
let cooldownTimeout = null;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Controller for handling tooltip opened state.
|
|
28
|
+
*/
|
|
29
|
+
class TooltipStateController {
|
|
30
|
+
constructor(host) {
|
|
31
|
+
this.host = host;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Schedule opening the tooltip.
|
|
36
|
+
* @param {Object} options
|
|
37
|
+
*/
|
|
38
|
+
open(options = { immediate: false }) {
|
|
39
|
+
const { immediate, hover, focus } = options;
|
|
40
|
+
const isHover = hover && this.hoverDelay > 0;
|
|
41
|
+
const isFocus = focus && this.focusDelay > 0;
|
|
42
|
+
|
|
43
|
+
if (!immediate && (isHover || isFocus) && !this.__closeTimeout) {
|
|
44
|
+
this.__warmupTooltip(isFocus);
|
|
45
|
+
} else {
|
|
46
|
+
this.__showTooltip();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Schedule closing the tooltip.
|
|
52
|
+
* @param {boolean} immediate
|
|
53
|
+
*/
|
|
54
|
+
close(immediate) {
|
|
55
|
+
if (!immediate && this.hideDelay > 0) {
|
|
56
|
+
this.__scheduleClose();
|
|
57
|
+
} else {
|
|
58
|
+
this.__abortClose();
|
|
59
|
+
this._setOpened(false);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.__abortWarmUp();
|
|
63
|
+
|
|
64
|
+
if (warmedUp) {
|
|
65
|
+
// Re-start cooldown timer on each tooltip closing.
|
|
66
|
+
this.__abortCooldown();
|
|
67
|
+
this.__scheduleCooldown();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @private */
|
|
72
|
+
get openedProp() {
|
|
73
|
+
return this.host.manual ? 'opened' : '_autoOpened';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** @private */
|
|
77
|
+
get focusDelay() {
|
|
78
|
+
const tooltip = this.host;
|
|
79
|
+
return tooltip.focusDelay != null && tooltip.focusDelay > 0 ? tooltip.focusDelay : defaultFocusDelay;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** @private */
|
|
83
|
+
get hoverDelay() {
|
|
84
|
+
const tooltip = this.host;
|
|
85
|
+
return tooltip.hoverDelay != null && tooltip.hoverDelay > 0 ? tooltip.hoverDelay : defaultHoverDelay;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @private */
|
|
89
|
+
get hideDelay() {
|
|
90
|
+
const tooltip = this.host;
|
|
91
|
+
return tooltip.hideDelay != null && tooltip.hideDelay > 0 ? tooltip.hideDelay : defaultHideDelay;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** @private */
|
|
95
|
+
_isOpened() {
|
|
96
|
+
return this.host[this.openedProp];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @private */
|
|
100
|
+
_setOpened(opened) {
|
|
101
|
+
this.host[this.openedProp] = opened;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** @private */
|
|
105
|
+
__flushClosingTooltips() {
|
|
106
|
+
closing.forEach((tooltip) => {
|
|
107
|
+
tooltip._stateController.close(true);
|
|
108
|
+
closing.delete(tooltip);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @private */
|
|
113
|
+
__showTooltip() {
|
|
114
|
+
this.__abortClose();
|
|
115
|
+
this.__flushClosingTooltips();
|
|
116
|
+
|
|
117
|
+
this._setOpened(true);
|
|
118
|
+
warmedUp = true;
|
|
119
|
+
|
|
120
|
+
// Abort previously scheduled timers.
|
|
121
|
+
this.__abortWarmUp();
|
|
122
|
+
this.__abortCooldown();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** @private */
|
|
126
|
+
__warmupTooltip(isFocus) {
|
|
127
|
+
if (!this._isOpened()) {
|
|
128
|
+
// First tooltip is opened, warm up.
|
|
129
|
+
if (!warmedUp) {
|
|
130
|
+
this.__scheduleWarmUp(isFocus);
|
|
131
|
+
} else {
|
|
132
|
+
// Warmed up, show another tooltip.
|
|
133
|
+
this.__showTooltip();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @private */
|
|
139
|
+
__abortClose() {
|
|
140
|
+
if (this.__closeTimeout) {
|
|
141
|
+
clearTimeout(this.__closeTimeout);
|
|
142
|
+
this.__closeTimeout = null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** @private */
|
|
147
|
+
__abortCooldown() {
|
|
148
|
+
if (cooldownTimeout) {
|
|
149
|
+
clearTimeout(cooldownTimeout);
|
|
150
|
+
cooldownTimeout = null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** @private */
|
|
155
|
+
__abortWarmUp() {
|
|
156
|
+
if (warmUpTimeout) {
|
|
157
|
+
clearTimeout(warmUpTimeout);
|
|
158
|
+
warmUpTimeout = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** @private */
|
|
163
|
+
__scheduleClose() {
|
|
164
|
+
if (this._isOpened()) {
|
|
165
|
+
closing.add(this.host);
|
|
166
|
+
|
|
167
|
+
this.__closeTimeout = setTimeout(() => {
|
|
168
|
+
closing.delete(this.host);
|
|
169
|
+
this.__closeTimeout = null;
|
|
170
|
+
this._setOpened(false);
|
|
171
|
+
}, this.hideDelay);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** @private */
|
|
176
|
+
__scheduleCooldown() {
|
|
177
|
+
cooldownTimeout = setTimeout(() => {
|
|
178
|
+
cooldownTimeout = null;
|
|
179
|
+
warmedUp = false;
|
|
180
|
+
}, this.hideDelay);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** @private */
|
|
184
|
+
__scheduleWarmUp(isFocus) {
|
|
185
|
+
const delay = isFocus ? this.focusDelay : this.hoverDelay;
|
|
186
|
+
warmUpTimeout = setTimeout(() => {
|
|
187
|
+
warmUpTimeout = null;
|
|
188
|
+
warmedUp = true;
|
|
189
|
+
this.__showTooltip();
|
|
190
|
+
}, delay);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
26
194
|
/**
|
|
27
195
|
* `<vaadin-tooltip>` is a Web Component for creating tooltips.
|
|
28
196
|
*
|
|
@@ -82,13 +250,13 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
82
250
|
role="tooltip"
|
|
83
251
|
renderer="[[_renderer]]"
|
|
84
252
|
theme$="[[_theme]]"
|
|
85
|
-
opened="[[__computeOpened(manual, opened, _autoOpened)]]"
|
|
253
|
+
opened="[[__computeOpened(manual, opened, _autoOpened, _isConnected)]]"
|
|
86
254
|
position-target="[[target]]"
|
|
87
|
-
position="[[
|
|
88
|
-
no-horizontal-overlap$="[[__computeNoHorizontalOverlap(
|
|
89
|
-
no-vertical-overlap$="[[__computeNoVerticalOverlap(
|
|
90
|
-
horizontal-align="[[__computeHorizontalAlign(
|
|
91
|
-
vertical-align="[[__computeVerticalAlign(
|
|
255
|
+
position="[[__effectivePosition]]"
|
|
256
|
+
no-horizontal-overlap$="[[__computeNoHorizontalOverlap(__effectivePosition)]]"
|
|
257
|
+
no-vertical-overlap$="[[__computeNoVerticalOverlap(__effectivePosition)]]"
|
|
258
|
+
horizontal-align="[[__computeHorizontalAlign(__effectivePosition)]]"
|
|
259
|
+
vertical-align="[[__computeVerticalAlign(__effectivePosition)]]"
|
|
92
260
|
on-mouseleave="__onOverlayMouseLeave"
|
|
93
261
|
modeless
|
|
94
262
|
></vaadin-tooltip-overlay>
|
|
@@ -111,7 +279,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
111
279
|
|
|
112
280
|
/**
|
|
113
281
|
* The delay in milliseconds before the tooltip
|
|
114
|
-
* is opened on focus, when not in manual mode.
|
|
282
|
+
* is opened on keyboard focus, when not in manual mode.
|
|
115
283
|
* @attr {number} focus-delay
|
|
116
284
|
*/
|
|
117
285
|
focusDelay: {
|
|
@@ -173,7 +341,6 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
173
341
|
*/
|
|
174
342
|
position: {
|
|
175
343
|
type: String,
|
|
176
|
-
value: 'bottom',
|
|
177
344
|
},
|
|
178
345
|
|
|
179
346
|
/**
|
|
@@ -228,6 +395,21 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
228
395
|
observer: '__autoOpenedChanged',
|
|
229
396
|
},
|
|
230
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Default value used when `position` property is not set.
|
|
400
|
+
* @protected
|
|
401
|
+
*/
|
|
402
|
+
_position: {
|
|
403
|
+
type: String,
|
|
404
|
+
value: 'bottom',
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
/** @private */
|
|
408
|
+
__effectivePosition: {
|
|
409
|
+
type: String,
|
|
410
|
+
computed: '__computePosition(position, _position)',
|
|
411
|
+
},
|
|
412
|
+
|
|
231
413
|
/** @protected */
|
|
232
414
|
_overlayElement: Object,
|
|
233
415
|
|
|
@@ -236,6 +418,11 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
236
418
|
type: Boolean,
|
|
237
419
|
value: false,
|
|
238
420
|
},
|
|
421
|
+
|
|
422
|
+
/** @private */
|
|
423
|
+
_isConnected: {
|
|
424
|
+
type: Boolean,
|
|
425
|
+
},
|
|
239
426
|
};
|
|
240
427
|
}
|
|
241
428
|
|
|
@@ -292,6 +479,15 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
292
479
|
},
|
|
293
480
|
{ threshold: 1 },
|
|
294
481
|
);
|
|
482
|
+
|
|
483
|
+
this._stateController = new TooltipStateController(this);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** @protected */
|
|
487
|
+
connectedCallback() {
|
|
488
|
+
super.connectedCallback();
|
|
489
|
+
|
|
490
|
+
this._isConnected = true;
|
|
295
491
|
}
|
|
296
492
|
|
|
297
493
|
/** @protected */
|
|
@@ -299,8 +495,9 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
299
495
|
super.disconnectedCallback();
|
|
300
496
|
|
|
301
497
|
if (this._autoOpened) {
|
|
302
|
-
this.
|
|
498
|
+
this._stateController.close(true);
|
|
303
499
|
}
|
|
500
|
+
this._isConnected = false;
|
|
304
501
|
}
|
|
305
502
|
|
|
306
503
|
/** @private */
|
|
@@ -324,8 +521,13 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
324
521
|
}
|
|
325
522
|
|
|
326
523
|
/** @private */
|
|
327
|
-
__computeOpened(manual, opened, autoOpened) {
|
|
328
|
-
return manual ? opened : autoOpened;
|
|
524
|
+
__computeOpened(manual, opened, autoOpened, connected) {
|
|
525
|
+
return connected && (manual ? opened : autoOpened);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** @private */
|
|
529
|
+
__computePosition(position, defaultPosition) {
|
|
530
|
+
return position || defaultPosition;
|
|
329
531
|
}
|
|
330
532
|
|
|
331
533
|
/** @private */
|
|
@@ -408,7 +610,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
408
610
|
this.__focusInside = true;
|
|
409
611
|
|
|
410
612
|
if (!this.__isTargetHidden && (!this.__hoverInside || !this._autoOpened)) {
|
|
411
|
-
this.
|
|
613
|
+
this._stateController.open({ focus: true });
|
|
412
614
|
}
|
|
413
615
|
}
|
|
414
616
|
|
|
@@ -426,7 +628,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
426
628
|
this.__focusInside = false;
|
|
427
629
|
|
|
428
630
|
if (!this.__hoverInside) {
|
|
429
|
-
this.
|
|
631
|
+
this._stateController.close(true);
|
|
430
632
|
}
|
|
431
633
|
}
|
|
432
634
|
|
|
@@ -434,13 +636,13 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
434
636
|
__onKeyDown(event) {
|
|
435
637
|
if (event.key === 'Escape') {
|
|
436
638
|
event.stopPropagation();
|
|
437
|
-
this.
|
|
639
|
+
this._stateController.close(true);
|
|
438
640
|
}
|
|
439
641
|
}
|
|
440
642
|
|
|
441
643
|
/** @private */
|
|
442
644
|
__onMouseDown() {
|
|
443
|
-
this.
|
|
645
|
+
this._stateController.close(true);
|
|
444
646
|
}
|
|
445
647
|
|
|
446
648
|
/** @private */
|
|
@@ -461,7 +663,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
461
663
|
this.__hoverInside = true;
|
|
462
664
|
|
|
463
665
|
if (!this.__isTargetHidden && (!this.__focusInside || !this._autoOpened)) {
|
|
464
|
-
this.
|
|
666
|
+
this._stateController.open({ hover: true });
|
|
465
667
|
}
|
|
466
668
|
}
|
|
467
669
|
|
|
@@ -488,7 +690,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
488
690
|
this.__hoverInside = false;
|
|
489
691
|
|
|
490
692
|
if (!this.__focusInside) {
|
|
491
|
-
this.
|
|
693
|
+
this._stateController.close();
|
|
492
694
|
}
|
|
493
695
|
}
|
|
494
696
|
|
|
@@ -499,13 +701,13 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
499
701
|
|
|
500
702
|
// Open the overlay when the target becomes visible and has focus or hover.
|
|
501
703
|
if (oldHidden && isVisible && (this.__focusInside || this.__hoverInside)) {
|
|
502
|
-
this.
|
|
704
|
+
this._stateController.open({ immediate: true });
|
|
503
705
|
return;
|
|
504
706
|
}
|
|
505
707
|
|
|
506
708
|
// Close the overlay when the target is no longer fully visible.
|
|
507
709
|
if (!isVisible && this._autoOpened) {
|
|
508
|
-
this.
|
|
710
|
+
this._stateController.close(true);
|
|
509
711
|
}
|
|
510
712
|
}
|
|
511
713
|
|
|
@@ -518,149 +720,6 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
518
720
|
return true;
|
|
519
721
|
}
|
|
520
722
|
|
|
521
|
-
/**
|
|
522
|
-
* Schedule opening the tooltip.
|
|
523
|
-
* @param {boolean} immediate
|
|
524
|
-
* @protected
|
|
525
|
-
*/
|
|
526
|
-
_open(options = { immediate: false }) {
|
|
527
|
-
const { immediate, hover, focus } = options;
|
|
528
|
-
const isHover = hover && this.__getHoverDelay() > 0;
|
|
529
|
-
const isFocus = focus && this.__getFocusDelay() > 0;
|
|
530
|
-
|
|
531
|
-
if (!immediate && (isHover || isFocus) && !this.__closeTimeout) {
|
|
532
|
-
this.__warmupTooltip(isFocus);
|
|
533
|
-
} else {
|
|
534
|
-
this.__showTooltip();
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Schedule closing the tooltip.
|
|
540
|
-
* @param {boolean} immediate
|
|
541
|
-
* @protected
|
|
542
|
-
*/
|
|
543
|
-
_close(immediate) {
|
|
544
|
-
if (!immediate && this.__getHideDelay() > 0) {
|
|
545
|
-
this.__scheduleClose();
|
|
546
|
-
} else {
|
|
547
|
-
this.__abortClose();
|
|
548
|
-
this._autoOpened = false;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
this.__abortWarmUp();
|
|
552
|
-
|
|
553
|
-
if (warmedUp) {
|
|
554
|
-
// Re-start cooldown timer on each tooltip closing.
|
|
555
|
-
this.__abortCooldown();
|
|
556
|
-
this.__scheduleCooldown();
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/** @private */
|
|
561
|
-
__getFocusDelay() {
|
|
562
|
-
return this.focusDelay != null && this.focusDelay > 0 ? this.focusDelay : defaultFocusDelay;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/** @private */
|
|
566
|
-
__getHoverDelay() {
|
|
567
|
-
return this.hoverDelay != null && this.hoverDelay > 0 ? this.hoverDelay : defaultHoverDelay;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
/** @private */
|
|
571
|
-
__getHideDelay() {
|
|
572
|
-
return this.hideDelay != null && this.hideDelay > 0 ? this.hideDelay : defaultHideDelay;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/** @private */
|
|
576
|
-
__flushClosingTooltips() {
|
|
577
|
-
closing.forEach((tooltip) => {
|
|
578
|
-
tooltip._close(true);
|
|
579
|
-
closing.delete(tooltip);
|
|
580
|
-
});
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/** @private */
|
|
584
|
-
__showTooltip() {
|
|
585
|
-
this.__abortClose();
|
|
586
|
-
this.__flushClosingTooltips();
|
|
587
|
-
|
|
588
|
-
this._autoOpened = true;
|
|
589
|
-
warmedUp = true;
|
|
590
|
-
|
|
591
|
-
// Abort previously scheduled timers.
|
|
592
|
-
this.__abortWarmUp();
|
|
593
|
-
this.__abortCooldown();
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/** @private */
|
|
597
|
-
__warmupTooltip(isFocus) {
|
|
598
|
-
if (!this._autoOpened) {
|
|
599
|
-
// First tooltip is opened, warm up.
|
|
600
|
-
if (!warmedUp) {
|
|
601
|
-
this.__scheduleWarmUp(isFocus);
|
|
602
|
-
} else {
|
|
603
|
-
// Warmed up, show another tooltip.
|
|
604
|
-
this.__showTooltip();
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/** @private */
|
|
610
|
-
__abortClose() {
|
|
611
|
-
if (this.__closeTimeout) {
|
|
612
|
-
clearTimeout(this.__closeTimeout);
|
|
613
|
-
this.__closeTimeout = null;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
/** @private */
|
|
618
|
-
__abortCooldown() {
|
|
619
|
-
if (cooldownTimeout) {
|
|
620
|
-
clearTimeout(cooldownTimeout);
|
|
621
|
-
cooldownTimeout = null;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/** @private */
|
|
626
|
-
__abortWarmUp() {
|
|
627
|
-
if (warmUpTimeout) {
|
|
628
|
-
clearTimeout(warmUpTimeout);
|
|
629
|
-
warmUpTimeout = null;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/** @private */
|
|
634
|
-
__scheduleClose() {
|
|
635
|
-
if (this._autoOpened) {
|
|
636
|
-
closing.add(this);
|
|
637
|
-
|
|
638
|
-
this.__closeTimeout = setTimeout(() => {
|
|
639
|
-
closing.delete(this);
|
|
640
|
-
this.__closeTimeout = null;
|
|
641
|
-
this._autoOpened = false;
|
|
642
|
-
}, this.__getHideDelay());
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/** @private */
|
|
647
|
-
__scheduleCooldown() {
|
|
648
|
-
cooldownTimeout = setTimeout(() => {
|
|
649
|
-
cooldownTimeout = null;
|
|
650
|
-
warmedUp = false;
|
|
651
|
-
}, this.__getHideDelay());
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/** @private */
|
|
655
|
-
__scheduleWarmUp(isFocus) {
|
|
656
|
-
const delay = isFocus ? this.__getFocusDelay() : this.__getHoverDelay();
|
|
657
|
-
warmUpTimeout = setTimeout(() => {
|
|
658
|
-
warmUpTimeout = null;
|
|
659
|
-
warmedUp = true;
|
|
660
|
-
this.__showTooltip();
|
|
661
|
-
}, delay);
|
|
662
|
-
}
|
|
663
|
-
|
|
664
723
|
/** @private */
|
|
665
724
|
__textChanged(text, oldText) {
|
|
666
725
|
if (this._overlayElement && (text || oldText)) {
|
|
@@ -12,8 +12,8 @@ const tooltipOverlay = css`
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
[part='overlay'] {
|
|
15
|
-
background-color
|
|
16
|
-
color: var(--lumo-
|
|
15
|
+
background: var(--lumo-base-color) linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
|
|
16
|
+
color: var(--lumo-body-text-color);
|
|
17
17
|
font-size: var(--lumo-font-size-xs);
|
|
18
18
|
}
|
|
19
19
|
|
package/web-types.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/tooltip",
|
|
4
|
-
"version": "23.3.0-
|
|
4
|
+
"version": "23.3.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-tooltip",
|
|
11
|
-
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-
|
|
11
|
+
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-overlay) documentation\nfor `<vaadin-tooltip-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "focus-delay",
|
|
15
|
-
"description": "The delay in milliseconds before the tooltip\nis opened on focus, when not in manual mode.",
|
|
15
|
+
"description": "The delay in milliseconds before the tooltip\nis opened on keyboard focus, when not in manual mode.",
|
|
16
16
|
"value": {
|
|
17
17
|
"type": [
|
|
18
18
|
"number",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"name": "focusDelay",
|
|
128
|
-
"description": "The delay in milliseconds before the tooltip\nis opened on focus, when not in manual mode.",
|
|
128
|
+
"description": "The delay in milliseconds before the tooltip\nis opened on keyboard focus, when not in manual mode.",
|
|
129
129
|
"value": {
|
|
130
130
|
"type": [
|
|
131
131
|
"number",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/tooltip",
|
|
4
|
-
"version": "23.3.0-
|
|
4
|
+
"version": "23.3.0-alpha3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-tooltip",
|
|
19
|
-
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-
|
|
19
|
+
"description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Styling\n\n`<vaadin-tooltip>` uses `<vaadin-tooltip-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha3/#/elements/vaadin-overlay) documentation\nfor `<vaadin-tooltip-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-tooltip>` is\npropagated to the internal `<vaadin-tooltip-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-tooltip>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-tooltip-offset-top` | Used as an offset when the tooltip is aligned vertically below the target\n`--vaadin-tooltip-offset-bottom` | Used as an offset when the tooltip is aligned vertically above the target\n`--vaadin-tooltip-offset-start` | Used as an offset when the tooltip is aligned horizontally after the target\n`--vaadin-tooltip-offset-end` | Used as an offset when the tooltip is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"name": ".focusDelay",
|
|
45
|
-
"description": "The delay in milliseconds before the tooltip\nis opened on focus, when not in manual mode.",
|
|
45
|
+
"description": "The delay in milliseconds before the tooltip\nis opened on keyboard focus, when not in manual mode.",
|
|
46
46
|
"value": {
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|