@vaadin/tooltip 23.3.0-alpha3 → 23.3.0-alpha4

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": "23.3.0-alpha3",
3
+ "version": "23.3.0-alpha4",
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-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"
38
+ "@vaadin/component-base": "23.3.0-alpha4",
39
+ "@vaadin/overlay": "23.3.0-alpha4",
40
+ "@vaadin/vaadin-lumo-styles": "23.3.0-alpha4",
41
+ "@vaadin/vaadin-material-styles": "23.3.0-alpha4",
42
+ "@vaadin/vaadin-themable-mixin": "23.3.0-alpha4"
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": "e86cd2abf3e28bade37711291331415d92c454ec"
53
+ "gitHead": "da037c0aa36e4b2874f253967300f6ca1af27315"
54
54
  }
@@ -3,13 +3,17 @@
3
3
  * Copyright (c) 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
7
- import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
6
+ import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
7
+ import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
8
8
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
9
 
10
10
  registerStyles(
11
11
  'vaadin-tooltip-overlay',
12
12
  css`
13
+ [part='overlay'] {
14
+ max-width: 40ch;
15
+ }
16
+
13
17
  :host([position^='top'][top-aligned]) [part='overlay'],
14
18
  :host([position^='bottom'][top-aligned]) [part='overlay'] {
15
19
  margin-top: var(--vaadin-tooltip-offset-top, 0);
@@ -38,10 +42,10 @@ let memoizedTemplate;
38
42
  /**
39
43
  * An element used internally by `<vaadin-tooltip>`. Not intended to be used separately.
40
44
  *
41
- * @extends OverlayElement
45
+ * @extends Overlay
42
46
  * @private
43
47
  */
44
- class TooltipOverlay extends PositionMixin(OverlayElement) {
48
+ class TooltipOverlay extends PositionMixin(Overlay) {
45
49
  static get is() {
46
50
  return 'vaadin-tooltip-overlay';
47
51
  }
@@ -472,6 +472,7 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
472
472
  this.__onMouseEnter = this.__onMouseEnter.bind(this);
473
473
  this.__onMouseLeave = this.__onMouseLeave.bind(this);
474
474
  this.__onKeyDown = this.__onKeyDown.bind(this);
475
+ this.__onOverlayOpen = this.__onOverlayOpen.bind(this);
475
476
 
476
477
  this.__targetVisibilityObserver = new IntersectionObserver(
477
478
  ([entry]) => {
@@ -488,6 +489,8 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
488
489
  super.connectedCallback();
489
490
 
490
491
  this._isConnected = true;
492
+
493
+ document.body.addEventListener('vaadin-overlay-open', this.__onOverlayOpen);
491
494
  }
492
495
 
493
496
  /** @protected */
@@ -498,6 +501,8 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
498
501
  this._stateController.close(true);
499
502
  }
500
503
  this._isConnected = false;
504
+
505
+ document.body.removeEventListener('vaadin-overlay-open', this.__onOverlayOpen);
501
506
  }
502
507
 
503
508
  /** @private */
@@ -694,6 +699,18 @@ class Tooltip extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
694
699
  }
695
700
  }
696
701
 
702
+ /** @private */
703
+ __onOverlayOpen() {
704
+ if (this.manual) {
705
+ return;
706
+ }
707
+
708
+ // Close tooltip if another overlay is opened on top of the tooltip's overlay
709
+ if (this._overlayElement.opened && !this._overlayElement._last) {
710
+ this._stateController.close(true);
711
+ }
712
+ }
713
+
697
714
  /** @private */
698
715
  __onTargetVisibilityChange(isVisible) {
699
716
  const oldHidden = this.__isTargetHidden;
@@ -1,5 +1,6 @@
1
1
  import '@vaadin/vaadin-lumo-styles/color.js';
2
2
  import '@vaadin/vaadin-lumo-styles/style.js';
3
+ import '@vaadin/vaadin-lumo-styles/typography.js';
3
4
  import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
4
5
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
6
 
@@ -15,6 +16,7 @@ const tooltipOverlay = css`
15
16
  background: var(--lumo-base-color) linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
16
17
  color: var(--lumo-body-text-color);
17
18
  font-size: var(--lumo-font-size-xs);
19
+ line-height: var(--lumo-line-height-s);
18
20
  }
19
21
 
20
22
  [part='content'] {
@@ -1,3 +1,3 @@
1
- import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
1
+ import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
2
2
  import './vaadin-tooltip-styles.js';
3
3
  import '../../src/vaadin-tooltip.js';
@@ -1,3 +1,3 @@
1
- import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
1
+ import '@vaadin/overlay/theme/material/vaadin-overlay.js';
2
2
  import './vaadin-tooltip-styles.js';
3
3
  import '../../src/vaadin-tooltip.js';
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": "23.3.0-alpha3",
4
+ "version": "23.3.0-alpha4",
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-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.",
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-alpha4/#/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",
@@ -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-alpha3",
4
+ "version": "23.3.0-alpha4",
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-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.",
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-alpha4/#/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
  {