@vaadin/field-highlighter 23.1.0-beta2 → 23.1.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/field-highlighter",
3
- "version": "23.1.0-beta2",
3
+ "version": "23.1.0-beta3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,27 +34,27 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "23.1.0-beta2",
38
- "@vaadin/vaadin-lumo-styles": "23.1.0-beta2",
39
- "@vaadin/vaadin-material-styles": "23.1.0-beta2",
40
- "@vaadin/vaadin-overlay": "23.1.0-beta2",
41
- "@vaadin/vaadin-themable-mixin": "23.1.0-beta2",
37
+ "@vaadin/component-base": "23.1.0-beta3",
38
+ "@vaadin/vaadin-lumo-styles": "23.1.0-beta3",
39
+ "@vaadin/vaadin-material-styles": "23.1.0-beta3",
40
+ "@vaadin/vaadin-overlay": "23.1.0-beta3",
41
+ "@vaadin/vaadin-themable-mixin": "23.1.0-beta3",
42
42
  "lit": "^2.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
46
- "@vaadin/checkbox": "23.1.0-beta2",
47
- "@vaadin/combo-box": "23.1.0-beta2",
48
- "@vaadin/date-picker": "23.1.0-beta2",
49
- "@vaadin/date-time-picker": "23.1.0-beta2",
50
- "@vaadin/item": "23.1.0-beta2",
51
- "@vaadin/list-box": "23.1.0-beta2",
52
- "@vaadin/radio-group": "23.1.0-beta2",
53
- "@vaadin/select": "23.1.0-beta2",
46
+ "@vaadin/checkbox": "23.1.0-beta3",
47
+ "@vaadin/combo-box": "23.1.0-beta3",
48
+ "@vaadin/date-picker": "23.1.0-beta3",
49
+ "@vaadin/date-time-picker": "23.1.0-beta3",
50
+ "@vaadin/item": "23.1.0-beta3",
51
+ "@vaadin/list-box": "23.1.0-beta3",
52
+ "@vaadin/radio-group": "23.1.0-beta3",
53
+ "@vaadin/select": "23.1.0-beta3",
54
54
  "@vaadin/testing-helpers": "^0.3.2",
55
- "@vaadin/text-field": "23.1.0-beta2",
56
- "@vaadin/time-picker": "23.1.0-beta2",
55
+ "@vaadin/text-field": "23.1.0-beta3",
56
+ "@vaadin/time-picker": "23.1.0-beta3",
57
57
  "sinon": "^13.0.2"
58
58
  },
59
- "gitHead": "f11f9245a0b5e6bf912725a501c27c24b74e7c8d"
59
+ "gitHead": "c787ceb8a312f88631c6d429ff320d5f89b1b838"
60
60
  }
@@ -4,17 +4,15 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
7
+ import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
7
8
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
 
9
10
  registerStyles(
10
11
  'vaadin-user-tags-overlay',
11
12
  css`
12
13
  :host {
13
- align-items: stretch;
14
- justify-content: flex-start;
15
14
  background: transparent;
16
15
  box-shadow: none;
17
- bottom: auto;
18
16
  }
19
17
 
20
18
  [part='overlay'] {
@@ -42,14 +40,6 @@ registerStyles(
42
40
  padding: 0;
43
41
  }
44
42
 
45
- :host([dir='rtl']) {
46
- left: auto;
47
- }
48
-
49
- :host(:not([dir='rtl'])) {
50
- right: auto;
51
- }
52
-
53
43
  :host([opening]),
54
44
  :host([closing]) {
55
45
  animation: 0.14s user-tags-overlay-dummy-animation;
@@ -73,7 +63,7 @@ registerStyles(
73
63
  * @extends OverlayElement
74
64
  * @private
75
65
  */
76
- class UserTagsOverlay extends OverlayElement {
66
+ class UserTagsOverlay extends PositionMixin(OverlayElement) {
77
67
  static get is() {
78
68
  return 'vaadin-user-tags-overlay';
79
69
  }
@@ -45,6 +45,7 @@ export class UserTags extends PolymerElement {
45
45
  id="overlay"
46
46
  modeless
47
47
  opened="[[opened]]"
48
+ no-vertical-overlap
48
49
  on-vaadin-overlay-open="_onOverlayOpen"
49
50
  ></vaadin-user-tags-overlay>
50
51
  `;
@@ -68,7 +69,6 @@ export class UserTags extends PolymerElement {
68
69
  opened: {
69
70
  type: Boolean,
70
71
  value: false,
71
- observer: '_openedChanged',
72
72
  },
73
73
 
74
74
  /**
@@ -85,6 +85,7 @@ export class UserTags extends PolymerElement {
85
85
  */
86
86
  target: {
87
87
  type: Object,
88
+ observer: '__targetChanged',
88
89
  },
89
90
 
90
91
  /**
@@ -103,23 +104,9 @@ export class UserTags extends PolymerElement {
103
104
  };
104
105
  }
105
106
 
106
- constructor() {
107
- super();
108
- this._boundSetPosition = this._debounceSetPosition.bind(this);
109
- }
110
-
111
- /** @protected */
112
- connectedCallback() {
113
- super.connectedCallback();
114
- window.addEventListener('resize', this._boundSetPosition);
115
- window.addEventListener('scroll', this._boundSetPosition);
116
- }
117
-
118
107
  /** @protected */
119
108
  disconnectedCallback() {
120
109
  super.disconnectedCallback();
121
- window.removeEventListener('resize', this._boundSetPosition);
122
- window.removeEventListener('scroll', this._boundSetPosition);
123
110
  this.opened = false;
124
111
  }
125
112
 
@@ -138,15 +125,8 @@ export class UserTags extends PolymerElement {
138
125
  }
139
126
 
140
127
  /** @private */
141
- _debounceSetPosition() {
142
- this._debouncePosition = Debouncer.debounce(this._debouncePosition, timeOut.after(16), () => this._setPosition());
143
- }
144
-
145
- /** @private */
146
- _openedChanged(opened) {
147
- if (opened) {
148
- this._setPosition();
149
- }
128
+ __targetChanged(target) {
129
+ this.$.overlay.positionTarget = target;
150
130
  }
151
131
 
152
132
  /** @private */
@@ -156,34 +136,6 @@ export class UserTags extends PolymerElement {
156
136
  }
157
137
  }
158
138
 
159
- /**
160
- * Set position of the user tags overlay.
161
- * TODO: use PositionMixin instead.
162
- *
163
- * @private
164
- */
165
- _setPosition() {
166
- if (!this.opened) {
167
- return;
168
- }
169
-
170
- const targetRect = this.target.getBoundingClientRect();
171
-
172
- const overlayRect = this.$.overlay.getBoundingClientRect();
173
-
174
- this._translateX =
175
- this.getAttribute('dir') === 'rtl'
176
- ? targetRect.right - overlayRect.right + (this._translateX || 0)
177
- : targetRect.left - overlayRect.left + (this._translateX || 0);
178
- this._translateY = targetRect.top - overlayRect.top + (this._translateY || 0) + targetRect.height;
179
-
180
- const devicePixelRatio = window.devicePixelRatio || 1;
181
- this._translateX = Math.round(this._translateX * devicePixelRatio) / devicePixelRatio;
182
- this._translateY = Math.round(this._translateY * devicePixelRatio) / devicePixelRatio;
183
-
184
- this.$.overlay.style.transform = `translate3d(${this._translateX}px, ${this._translateY}px, 0)`;
185
- }
186
-
187
139
  get wrapper() {
188
140
  return this.$.overlay.content.querySelector('[part="tags"]');
189
141
  }