@vaadin/tooltip 24.2.3 → 24.3.0-alpha10
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 +13 -9
- package/src/vaadin-tooltip-mixin.d.ts +122 -0
- package/src/vaadin-tooltip-mixin.js +812 -0
- package/src/vaadin-tooltip-overlay-mixin.js +86 -0
- package/src/vaadin-tooltip-overlay-styles.d.ts +8 -0
- package/src/vaadin-tooltip-overlay-styles.js +42 -0
- package/src/vaadin-tooltip-overlay.js +5 -111
- package/src/vaadin-tooltip.d.ts +3 -107
- package/src/vaadin-tooltip.js +3 -796
- package/web-types.json +13 -13
- package/web-types.lit.json +9 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tooltip",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.3.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/vaadin-lit-tooltip-overlay.js",
|
|
25
|
+
"!src/vaadin-lit-tooltip.d.ts",
|
|
26
|
+
"!src/vaadin-lit-tooltip.js",
|
|
24
27
|
"theme",
|
|
25
28
|
"vaadin-*.d.ts",
|
|
26
29
|
"vaadin-*.js",
|
|
@@ -34,22 +37,23 @@
|
|
|
34
37
|
"web-component"
|
|
35
38
|
],
|
|
36
39
|
"dependencies": {
|
|
40
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
37
41
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/a11y-base": "
|
|
39
|
-
"@vaadin/component-base": "
|
|
40
|
-
"@vaadin/overlay": "
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
42
|
-
"@vaadin/vaadin-material-styles": "
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
42
|
+
"@vaadin/a11y-base": "24.3.0-alpha10",
|
|
43
|
+
"@vaadin/component-base": "24.3.0-alpha10",
|
|
44
|
+
"@vaadin/overlay": "24.3.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.3.0-alpha10",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.3.0-alpha10",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.3.0-alpha10"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
46
50
|
"@esm-bundle/chai": "^4.3.4",
|
|
47
|
-
"@vaadin/testing-helpers": "^0.
|
|
51
|
+
"@vaadin/testing-helpers": "^0.6.0",
|
|
48
52
|
"sinon": "^13.0.2"
|
|
49
53
|
},
|
|
50
54
|
"web-types": [
|
|
51
55
|
"web-types.json",
|
|
52
56
|
"web-types.lit.json"
|
|
53
57
|
],
|
|
54
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "0271523d93fe5df0425ff64206886614f3c6f401"
|
|
55
59
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2022 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
|
+
|
|
9
|
+
export type TooltipPosition =
|
|
10
|
+
| 'bottom-end'
|
|
11
|
+
| 'bottom-start'
|
|
12
|
+
| 'bottom'
|
|
13
|
+
| 'end-bottom'
|
|
14
|
+
| 'end-top'
|
|
15
|
+
| 'end'
|
|
16
|
+
| 'start-bottom'
|
|
17
|
+
| 'start-top'
|
|
18
|
+
| 'start'
|
|
19
|
+
| 'top-end'
|
|
20
|
+
| 'top-start'
|
|
21
|
+
| 'top';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A mixin providing common tooltip functionality.
|
|
25
|
+
*/
|
|
26
|
+
export declare function TooltipMixin<T extends Constructor<HTMLElement>>(
|
|
27
|
+
base: T,
|
|
28
|
+
): Constructor<OverlayClassMixinClass> & Constructor<TooltipMixinClass> & T;
|
|
29
|
+
|
|
30
|
+
export declare class TooltipMixinClass {
|
|
31
|
+
/**
|
|
32
|
+
* Element used to link with the `aria-describedby`
|
|
33
|
+
* attribute. Supports array of multiple elements.
|
|
34
|
+
* When not set, defaults to `target`.
|
|
35
|
+
*/
|
|
36
|
+
ariaTarget: HTMLElement | HTMLElement[] | undefined;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Object with properties passed to `generator` and
|
|
40
|
+
* `shouldShow` functions for generating tooltip text
|
|
41
|
+
* or detecting whether to show the tooltip or not.
|
|
42
|
+
*/
|
|
43
|
+
context: Record<string, unknown>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The delay in milliseconds before the tooltip
|
|
47
|
+
* is opened on keyboard focus, when not in manual mode.
|
|
48
|
+
* @attr {number} focus-delay
|
|
49
|
+
*/
|
|
50
|
+
focusDelay: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The id of the element used as a tooltip trigger.
|
|
54
|
+
* The element should be in the DOM by the time when
|
|
55
|
+
* the attribute is set, otherwise a warning is shown.
|
|
56
|
+
*/
|
|
57
|
+
for: string | undefined;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Function used to generate the tooltip content.
|
|
61
|
+
* When provided, it overrides the `text` property.
|
|
62
|
+
* Use the `context` property to provide argument
|
|
63
|
+
* that can be passed to the generator function.
|
|
64
|
+
*/
|
|
65
|
+
generator: (context: Record<string, unknown>) => string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The delay in milliseconds before the tooltip
|
|
69
|
+
* is closed on losing hover, when not in manual mode.
|
|
70
|
+
* On blur, the tooltip is closed immediately.
|
|
71
|
+
* @attr {number} hide-delay
|
|
72
|
+
*/
|
|
73
|
+
hideDelay: number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The delay in milliseconds before the tooltip
|
|
77
|
+
* is opened on hover, when not in manual mode.
|
|
78
|
+
* @attr {number} hover-delay
|
|
79
|
+
*/
|
|
80
|
+
hoverDelay: number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* When true, the tooltip is controlled programmatically
|
|
84
|
+
* instead of reacting to focus and mouse events.
|
|
85
|
+
*/
|
|
86
|
+
manual: boolean;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* When true, the tooltip is opened programmatically.
|
|
90
|
+
* Only works if `manual` is set to `true`.
|
|
91
|
+
*/
|
|
92
|
+
opened: boolean;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Position of the tooltip with respect to its target.
|
|
96
|
+
* Supported values: `top-start`, `top`, `top-end`,
|
|
97
|
+
* `bottom-start`, `bottom`, `bottom-end`, `start-top`,
|
|
98
|
+
* `start`, `start-bottom`, `end-top`, `end`, `end-bottom`.
|
|
99
|
+
*/
|
|
100
|
+
position: TooltipPosition;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Function used to detect whether to show the tooltip based on a condition,
|
|
104
|
+
* called every time the tooltip is about to be shown on hover and focus.
|
|
105
|
+
* The function takes two parameters: `target` and `context`, which contain
|
|
106
|
+
* values of the corresponding tooltip properties at the time of calling.
|
|
107
|
+
* The tooltip is only shown when the function invocation returns `true`.
|
|
108
|
+
*/
|
|
109
|
+
shouldShow: (target: HTMLElement, context?: Record<string, unknown>) => boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Reference to the element used as a tooltip trigger.
|
|
113
|
+
* The target must be placed in the same shadow scope.
|
|
114
|
+
* Defaults to an element referenced with `for`.
|
|
115
|
+
*/
|
|
116
|
+
target: HTMLElement | undefined;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* String used as a tooltip content.
|
|
120
|
+
*/
|
|
121
|
+
text: string | null | undefined;
|
|
122
|
+
}
|