@vaadin/tooltip 24.8.0-alpha9 → 25.0.0-alpha2
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/README.md +0 -23
- package/package.json +11 -13
- package/src/vaadin-tooltip-overlay.js +16 -14
- package/src/vaadin-tooltip.d.ts +1 -2
- package/src/vaadin-tooltip.js +28 -33
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-tooltip-overlay.js +0 -60
- package/src/vaadin-lit-tooltip.d.ts +0 -6
- package/src/vaadin-lit-tooltip.js +0 -71
- package/theme/lumo/vaadin-lit-tooltip.d.ts +0 -2
- package/theme/lumo/vaadin-lit-tooltip.js +0 -2
- package/theme/material/vaadin-lit-tooltip.d.ts +0 -2
- package/theme/material/vaadin-lit-tooltip.js +0 -2
- package/theme/material/vaadin-tooltip-styles.d.ts +0 -1
- package/theme/material/vaadin-tooltip-styles.js +0 -23
- package/theme/material/vaadin-tooltip.d.ts +0 -2
- package/theme/material/vaadin-tooltip.js +0 -2
- package/vaadin-lit-tooltip.d.ts +0 -1
- package/vaadin-lit-tooltip.js +0 -3
package/README.md
CHANGED
|
@@ -27,29 +27,6 @@ Once installed, import the component in your application:
|
|
|
27
27
|
import '@vaadin/tooltip';
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
## Themes
|
|
31
|
-
|
|
32
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
33
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/tooltip/vaadin-tooltip.js) of the package uses the Lumo theme.
|
|
34
|
-
|
|
35
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
import '@vaadin/tooltip/theme/material/vaadin-tooltip.js';
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
You can also import the Lumo version of the component explicitly:
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
import '@vaadin/tooltip/theme/lumo/vaadin-tooltip.js';
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
import '@vaadin/tooltip/src/vaadin-tooltip.js';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
30
|
## Contributing
|
|
54
31
|
|
|
55
32
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tooltip",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,25 +35,23 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@
|
|
39
|
-
"@vaadin/
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/vaadin-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha9",
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha2",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha2",
|
|
40
|
+
"@vaadin/overlay": "25.0.0-alpha2",
|
|
41
|
+
"@vaadin/popover": "25.0.0-alpha2",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
46
44
|
"lit": "^3.0.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "
|
|
50
|
-
"@vaadin/test-runner-commands": "
|
|
51
|
-
"@vaadin/testing-helpers": "^
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-alpha2",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
49
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
50
|
"sinon": "^18.0.0"
|
|
53
51
|
},
|
|
54
52
|
"web-types": [
|
|
55
53
|
"web-types.json",
|
|
56
54
|
"web-types.lit.json"
|
|
57
55
|
],
|
|
58
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
|
|
59
57
|
}
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
10
11
|
import { PopoverOverlayMixin } from '@vaadin/popover/src/vaadin-popover-overlay-mixin.js';
|
|
11
|
-
import {
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
13
|
import { tooltipOverlayStyles } from './vaadin-tooltip-overlay-styles.js';
|
|
13
14
|
|
|
14
|
-
registerStyles('vaadin-tooltip-overlay', [overlayStyles, tooltipOverlayStyles], {
|
|
15
|
-
moduleId: 'vaadin-tooltip-overlay-styles',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
15
|
/**
|
|
19
16
|
* An element used internally by `<vaadin-tooltip>`. Not intended to be used separately.
|
|
20
17
|
*
|
|
@@ -25,18 +22,13 @@ registerStyles('vaadin-tooltip-overlay', [overlayStyles, tooltipOverlayStyles],
|
|
|
25
22
|
* @mixes PopoverOverlayMixin
|
|
26
23
|
* @private
|
|
27
24
|
*/
|
|
28
|
-
class TooltipOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(
|
|
25
|
+
class TooltipOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
29
26
|
static get is() {
|
|
30
27
|
return 'vaadin-tooltip-overlay';
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
static get
|
|
34
|
-
return
|
|
35
|
-
<div id="backdrop" part="backdrop" hidden></div>
|
|
36
|
-
<div part="overlay" id="overlay">
|
|
37
|
-
<div part="content" id="content"><slot></slot></div>
|
|
38
|
-
</div>
|
|
39
|
-
`;
|
|
30
|
+
static get styles() {
|
|
31
|
+
return [overlayStyles, tooltipOverlayStyles];
|
|
40
32
|
}
|
|
41
33
|
|
|
42
34
|
/**
|
|
@@ -48,6 +40,16 @@ class TooltipOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolymerE
|
|
|
48
40
|
return 'vaadin-tooltip';
|
|
49
41
|
}
|
|
50
42
|
|
|
43
|
+
/** @protected */
|
|
44
|
+
render() {
|
|
45
|
+
return html`
|
|
46
|
+
<div id="backdrop" part="backdrop" hidden></div>
|
|
47
|
+
<div part="overlay" id="overlay">
|
|
48
|
+
<div part="content" id="content"><slot></slot></div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
|
|
51
53
|
requestContentUpdate() {
|
|
52
54
|
super.requestContentUpdate();
|
|
53
55
|
|
package/src/vaadin-tooltip.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
7
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
9
8
|
import { TooltipMixin } from './vaadin-tooltip-mixin.js';
|
|
@@ -48,7 +47,7 @@ export { TooltipPosition } from './vaadin-tooltip-mixin.js';
|
|
|
48
47
|
*
|
|
49
48
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
50
49
|
*/
|
|
51
|
-
declare class Tooltip extends TooltipMixin(ThemePropertyMixin(
|
|
50
|
+
declare class Tooltip extends TooltipMixin(ThemePropertyMixin(ElementMixin(HTMLElement))) {
|
|
52
51
|
/**
|
|
53
52
|
* Sets the default focus delay to be used by all tooltip instances,
|
|
54
53
|
* except for those that have focus delay configured using property.
|
package/src/vaadin-tooltip.js
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-tooltip-overlay.js';
|
|
7
|
-
import { html,
|
|
8
|
-
import {
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
12
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
12
13
|
import { TooltipMixin } from './vaadin-tooltip-mixin.js';
|
|
13
14
|
|
|
@@ -51,54 +52,48 @@ import { TooltipMixin } from './vaadin-tooltip-mixin.js';
|
|
|
51
52
|
*
|
|
52
53
|
* @customElement
|
|
53
54
|
* @extends HTMLElement
|
|
54
|
-
* @mixes ControllerMixin
|
|
55
55
|
* @mixes ElementMixin
|
|
56
56
|
* @mixes ThemePropertyMixin
|
|
57
57
|
* @mixes TooltipMixin
|
|
58
58
|
*/
|
|
59
|
-
class Tooltip extends TooltipMixin(ThemePropertyMixin(ElementMixin(
|
|
59
|
+
class Tooltip extends TooltipMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
60
60
|
static get is() {
|
|
61
61
|
return 'vaadin-tooltip';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
static get
|
|
64
|
+
static get styles() {
|
|
65
|
+
return css`
|
|
66
|
+
:host {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @protected */
|
|
73
|
+
render() {
|
|
74
|
+
const effectivePosition = this.__effectivePosition;
|
|
75
|
+
|
|
65
76
|
return html`
|
|
66
|
-
<style>
|
|
67
|
-
:host {
|
|
68
|
-
display: none;
|
|
69
|
-
}
|
|
70
|
-
</style>
|
|
71
77
|
<vaadin-tooltip-overlay
|
|
72
78
|
id="overlay"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
theme
|
|
76
|
-
opened="
|
|
77
|
-
|
|
78
|
-
position="
|
|
79
|
-
no-horizontal-overlap
|
|
80
|
-
no-vertical-overlap
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
.renderer="${this._renderer}"
|
|
80
|
+
.owner="${this}"
|
|
81
|
+
theme="${ifDefined(this._theme)}"
|
|
82
|
+
.opened="${this._isConnected && (this.manual ? this.opened : this._autoOpened)}"
|
|
83
|
+
.positionTarget="${this.target}"
|
|
84
|
+
.position="${effectivePosition}"
|
|
85
|
+
?no-horizontal-overlap="${this.__computeNoHorizontalOverlap(effectivePosition)}"
|
|
86
|
+
?no-vertical-overlap="${this.__computeNoVerticalOverlap(effectivePosition)}"
|
|
87
|
+
.horizontalAlign="${this.__computeHorizontalAlign(effectivePosition)}"
|
|
88
|
+
.verticalAlign="${this.__computeVerticalAlign(effectivePosition)}"
|
|
89
|
+
@mouseenter="${this.__onOverlayMouseEnter}"
|
|
90
|
+
@mouseleave="${this.__onOverlayMouseLeave}"
|
|
85
91
|
modeless
|
|
86
92
|
></vaadin-tooltip-overlay>
|
|
87
93
|
|
|
88
94
|
<slot name="sr-label"></slot>
|
|
89
95
|
`;
|
|
90
96
|
}
|
|
91
|
-
|
|
92
|
-
static get properties() {
|
|
93
|
-
return {
|
|
94
|
-
/** @private */
|
|
95
|
-
__overlayOwner: {
|
|
96
|
-
value() {
|
|
97
|
-
return this;
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
defineCustomElement(Tooltip);
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/tooltip",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
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/
|
|
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/25.0.0-alpha2/#/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/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "overlay-class",
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
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/
|
|
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/25.0.0-alpha2/#/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/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
11
|
-
import { PopoverOverlayMixin } from '@vaadin/popover/src/vaadin-popover-overlay-mixin.js';
|
|
12
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import { tooltipOverlayStyles } from './vaadin-tooltip-overlay-styles.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* An element used internally by `<vaadin-tooltip>`. Not intended to be used separately.
|
|
17
|
-
*
|
|
18
|
-
* @customElement
|
|
19
|
-
* @extends HTMLElement
|
|
20
|
-
* @mixes DirMixin
|
|
21
|
-
* @mixes ThemableMixin
|
|
22
|
-
* @mixes PopoverOverlayMixin
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
class TooltipOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-tooltip-overlay';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return [overlayStyles, tooltipOverlayStyles];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Tag name prefix used by custom properties.
|
|
36
|
-
* @protected
|
|
37
|
-
* @return {string}
|
|
38
|
-
*/
|
|
39
|
-
get _tagNamePrefix() {
|
|
40
|
-
return 'vaadin-tooltip';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** @protected */
|
|
44
|
-
render() {
|
|
45
|
-
return html`
|
|
46
|
-
<div id="backdrop" part="backdrop" hidden></div>
|
|
47
|
-
<div part="overlay" id="overlay">
|
|
48
|
-
<div part="content" id="content"><slot></slot></div>
|
|
49
|
-
</div>
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
requestContentUpdate() {
|
|
54
|
-
super.requestContentUpdate();
|
|
55
|
-
|
|
56
|
-
this.toggleAttribute('hidden', this.textContent.trim() === '');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
defineCustomElement(TooltipOverlay);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2022 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-tooltip-overlay.js';
|
|
7
|
-
import { css, html, LitElement } from 'lit';
|
|
8
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
-
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
13
|
-
import { TooltipMixin } from './vaadin-tooltip-mixin.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* LitElement based version of `<vaadin-tooltip>` web component.
|
|
17
|
-
*
|
|
18
|
-
* ## Disclaimer
|
|
19
|
-
*
|
|
20
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
21
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
22
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
23
|
-
*
|
|
24
|
-
* @extends HTMLElement
|
|
25
|
-
* @mixes ElementMixin
|
|
26
|
-
* @mixes ThemePropertyMixin
|
|
27
|
-
* @mixes TooltipMixin
|
|
28
|
-
*/
|
|
29
|
-
class Tooltip extends TooltipMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
30
|
-
static get is() {
|
|
31
|
-
return 'vaadin-tooltip';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static get styles() {
|
|
35
|
-
return css`
|
|
36
|
-
:host {
|
|
37
|
-
display: none;
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** @protected */
|
|
43
|
-
render() {
|
|
44
|
-
const effectivePosition = this.__effectivePosition;
|
|
45
|
-
|
|
46
|
-
return html`
|
|
47
|
-
<vaadin-tooltip-overlay
|
|
48
|
-
id="overlay"
|
|
49
|
-
.renderer="${this._renderer}"
|
|
50
|
-
.owner="${this}"
|
|
51
|
-
theme="${ifDefined(this._theme)}"
|
|
52
|
-
.opened="${this._isConnected && (this.manual ? this.opened : this._autoOpened)}"
|
|
53
|
-
.positionTarget="${this.target}"
|
|
54
|
-
.position="${effectivePosition}"
|
|
55
|
-
?no-horizontal-overlap="${this.__computeNoHorizontalOverlap(effectivePosition)}"
|
|
56
|
-
?no-vertical-overlap="${this.__computeNoVerticalOverlap(effectivePosition)}"
|
|
57
|
-
.horizontalAlign="${this.__computeHorizontalAlign(effectivePosition)}"
|
|
58
|
-
.verticalAlign="${this.__computeVerticalAlign(effectivePosition)}"
|
|
59
|
-
@mouseenter="${this.__onOverlayMouseEnter}"
|
|
60
|
-
@mouseleave="${this.__onOverlayMouseLeave}"
|
|
61
|
-
modeless
|
|
62
|
-
></vaadin-tooltip-overlay>
|
|
63
|
-
|
|
64
|
-
<slot name="sr-label"></slot>
|
|
65
|
-
`;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
defineCustomElement(Tooltip);
|
|
70
|
-
|
|
71
|
-
export { Tooltip };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
|
|
2
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
|
-
|
|
4
|
-
const tooltipOverlay = css`
|
|
5
|
-
:host {
|
|
6
|
-
--vaadin-tooltip-offset-top: 0.25rem;
|
|
7
|
-
--vaadin-tooltip-offset-bottom: 0.25rem;
|
|
8
|
-
--vaadin-tooltip-offset-start: 0.25rem;
|
|
9
|
-
--vaadin-tooltip-offset-end: 0.25rem;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
[part='overlay'] {
|
|
13
|
-
background-color: rgba(97, 97, 97, 0.92);
|
|
14
|
-
color: #fff;
|
|
15
|
-
font-size: 0.6875rem;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[part='content'] {
|
|
19
|
-
padding: 0.25rem 0.5rem;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
registerStyles('vaadin-tooltip-overlay', [overlay, tooltipOverlay], { moduleId: 'material-tooltip-overlay' });
|
package/vaadin-lit-tooltip.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-tooltip.js';
|
package/vaadin-lit-tooltip.js
DELETED