@vaadin/tooltip 24.2.0-beta2 → 24.2.0-beta3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/tooltip",
3
- "version": "24.2.0-beta2",
3
+ "version": "24.2.0-beta3",
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,13 +37,14 @@
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": "24.2.0-beta2",
39
- "@vaadin/component-base": "24.2.0-beta2",
40
- "@vaadin/overlay": "24.2.0-beta2",
41
- "@vaadin/vaadin-lumo-styles": "24.2.0-beta2",
42
- "@vaadin/vaadin-material-styles": "24.2.0-beta2",
43
- "@vaadin/vaadin-themable-mixin": "24.2.0-beta2"
42
+ "@vaadin/a11y-base": "24.2.0-beta3",
43
+ "@vaadin/component-base": "24.2.0-beta3",
44
+ "@vaadin/overlay": "24.2.0-beta3",
45
+ "@vaadin/vaadin-lumo-styles": "24.2.0-beta3",
46
+ "@vaadin/vaadin-material-styles": "24.2.0-beta3",
47
+ "@vaadin/vaadin-themable-mixin": "24.2.0-beta3"
44
48
  },
45
49
  "devDependencies": {
46
50
  "@esm-bundle/chai": "^4.3.4",
@@ -51,5 +55,5 @@
51
55
  "web-types.json",
52
56
  "web-types.lit.json"
53
57
  ],
54
- "gitHead": "4b852f9a12d4dade7f0fb3c73b7212436cebf310"
58
+ "gitHead": "91ea11e7ad706065340acdb93b92316919ce5e69"
55
59
  }
@@ -0,0 +1,140 @@
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
+ * Sets the default focus delay to be used by all tooltip instances,
33
+ * except for those that have focus delay configured using property.
34
+ */
35
+ static setDefaultFocusDelay(focusDelay: number): void;
36
+
37
+ /**
38
+ * Sets the default hide delay to be used by all tooltip instances,
39
+ * except for those that have hide delay configured using property.
40
+ */
41
+ static setDefaultHideDelay(hideDelay: number): void;
42
+
43
+ /**
44
+ * Sets the default hover delay to be used by all tooltip instances,
45
+ * except for those that have hover delay configured using property.
46
+ */
47
+ static setDefaultHoverDelay(delay: number): void;
48
+
49
+ /**
50
+ * Element used to link with the `aria-describedby`
51
+ * attribute. Supports array of multiple elements.
52
+ * When not set, defaults to `target`.
53
+ */
54
+ ariaTarget: HTMLElement | HTMLElement[] | undefined;
55
+
56
+ /**
57
+ * Object with properties passed to `generator` and
58
+ * `shouldShow` functions for generating tooltip text
59
+ * or detecting whether to show the tooltip or not.
60
+ */
61
+ context: Record<string, unknown>;
62
+
63
+ /**
64
+ * The delay in milliseconds before the tooltip
65
+ * is opened on keyboard focus, when not in manual mode.
66
+ * @attr {number} focus-delay
67
+ */
68
+ focusDelay: number;
69
+
70
+ /**
71
+ * The id of the element used as a tooltip trigger.
72
+ * The element should be in the DOM by the time when
73
+ * the attribute is set, otherwise a warning is shown.
74
+ */
75
+ for: string | undefined;
76
+
77
+ /**
78
+ * Function used to generate the tooltip content.
79
+ * When provided, it overrides the `text` property.
80
+ * Use the `context` property to provide argument
81
+ * that can be passed to the generator function.
82
+ */
83
+ generator: (context: Record<string, unknown>) => string;
84
+
85
+ /**
86
+ * The delay in milliseconds before the tooltip
87
+ * is closed on losing hover, when not in manual mode.
88
+ * On blur, the tooltip is closed immediately.
89
+ * @attr {number} hide-delay
90
+ */
91
+ hideDelay: number;
92
+
93
+ /**
94
+ * The delay in milliseconds before the tooltip
95
+ * is opened on hover, when not in manual mode.
96
+ * @attr {number} hover-delay
97
+ */
98
+ hoverDelay: number;
99
+
100
+ /**
101
+ * When true, the tooltip is controlled programmatically
102
+ * instead of reacting to focus and mouse events.
103
+ */
104
+ manual: boolean;
105
+
106
+ /**
107
+ * When true, the tooltip is opened programmatically.
108
+ * Only works if `manual` is set to `true`.
109
+ */
110
+ opened: boolean;
111
+
112
+ /**
113
+ * Position of the tooltip with respect to its target.
114
+ * Supported values: `top-start`, `top`, `top-end`,
115
+ * `bottom-start`, `bottom`, `bottom-end`, `start-top`,
116
+ * `start`, `start-bottom`, `end-top`, `end`, `end-bottom`.
117
+ */
118
+ position: TooltipPosition;
119
+
120
+ /**
121
+ * Function used to detect whether to show the tooltip based on a condition,
122
+ * called every time the tooltip is about to be shown on hover and focus.
123
+ * The function takes two parameters: `target` and `context`, which contain
124
+ * values of the corresponding tooltip properties at the time of calling.
125
+ * The tooltip is only shown when the function invocation returns `true`.
126
+ */
127
+ shouldShow: (target: HTMLElement, context?: Record<string, unknown>) => boolean;
128
+
129
+ /**
130
+ * Reference to the element used as a tooltip trigger.
131
+ * The target must be placed in the same shadow scope.
132
+ * Defaults to an element referenced with `for`.
133
+ */
134
+ target: HTMLElement | undefined;
135
+
136
+ /**
137
+ * String used as a tooltip content.
138
+ */
139
+ text: string | null | undefined;
140
+ }