@vaadin/field-highlighter 23.0.7 → 23.0.10

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.0.7",
3
+ "version": "23.0.10",
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.0.7",
38
- "@vaadin/vaadin-lumo-styles": "^23.0.7",
39
- "@vaadin/vaadin-material-styles": "^23.0.7",
40
- "@vaadin/vaadin-overlay": "^23.0.7",
41
- "@vaadin/vaadin-themable-mixin": "^23.0.7",
37
+ "@vaadin/component-base": "^23.0.10",
38
+ "@vaadin/vaadin-lumo-styles": "^23.0.10",
39
+ "@vaadin/vaadin-material-styles": "^23.0.10",
40
+ "@vaadin/vaadin-overlay": "^23.0.10",
41
+ "@vaadin/vaadin-themable-mixin": "^23.0.10",
42
42
  "lit": "^2.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
46
- "@vaadin/checkbox": "^23.0.7",
47
- "@vaadin/combo-box": "^23.0.7",
48
- "@vaadin/date-picker": "^23.0.7",
49
- "@vaadin/date-time-picker": "^23.0.7",
50
- "@vaadin/item": "^23.0.7",
51
- "@vaadin/list-box": "^23.0.7",
52
- "@vaadin/radio-group": "^23.0.7",
53
- "@vaadin/select": "^23.0.7",
46
+ "@vaadin/checkbox": "^23.0.10",
47
+ "@vaadin/combo-box": "^23.0.10",
48
+ "@vaadin/date-picker": "^23.0.10",
49
+ "@vaadin/date-time-picker": "^23.0.10",
50
+ "@vaadin/item": "^23.0.10",
51
+ "@vaadin/list-box": "^23.0.10",
52
+ "@vaadin/radio-group": "^23.0.10",
53
+ "@vaadin/select": "^23.0.10",
54
54
  "@vaadin/testing-helpers": "^0.3.2",
55
- "@vaadin/text-field": "^23.0.7",
56
- "@vaadin/time-picker": "^23.0.7",
55
+ "@vaadin/text-field": "^23.0.10",
56
+ "@vaadin/time-picker": "^23.0.10",
57
57
  "sinon": "^9.2.1"
58
58
  },
59
- "gitHead": "005c2d85db8f50cd3b239dd89ac467add6a71049"
59
+ "gitHead": "e8402a55ce0e823ae6da5c97486998cfd931b1d3"
60
60
  }
@@ -109,8 +109,8 @@ export class ComponentObserver {
109
109
  new CustomEvent(`vaadin-highlight-${action}`, {
110
110
  bubbles: true,
111
111
  composed: true,
112
- detail: { fieldIndex: this.getFieldIndex(field) }
113
- })
112
+ detail: { fieldIndex: this.getFieldIndex(field) },
113
+ }),
114
114
  );
115
115
  }
116
116
 
@@ -54,8 +54,8 @@ export class FieldOutline extends ThemableMixin(DirMixin(PolymerElement)) {
54
54
  user: {
55
55
  type: Object,
56
56
  value: null,
57
- observer: '_userChanged'
58
- }
57
+ observer: '_userChanged',
58
+ },
59
59
  };
60
60
  }
61
61
 
@@ -66,14 +66,14 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
66
66
  * Name of the user.
67
67
  */
68
68
  name: {
69
- type: String
69
+ type: String,
70
70
  },
71
71
 
72
72
  /**
73
73
  * Id of the user.
74
74
  */
75
75
  uid: {
76
- type: String
76
+ type: String,
77
77
  },
78
78
 
79
79
  /**
@@ -81,8 +81,8 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
81
81
  */
82
82
  colorIndex: {
83
83
  type: Number,
84
- observer: '_colorIndexChanged'
85
- }
84
+ observer: '_colorIndexChanged',
85
+ },
86
86
  };
87
87
  }
88
88
 
@@ -114,9 +114,9 @@ export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
114
114
  bubbles: true,
115
115
  composed: true,
116
116
  detail: {
117
- name: this.name
118
- }
119
- })
117
+ name: this.name,
118
+ },
119
+ }),
120
120
  );
121
121
  }
122
122
  }
@@ -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;
@@ -64,7 +54,7 @@ registerStyles(
64
54
  opacity: 1;
65
55
  }
66
56
  }
67
- `
57
+ `,
68
58
  );
69
59
 
70
60
  /**
@@ -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
  `;
@@ -59,7 +60,7 @@ export class UserTags extends PolymerElement {
59
60
  hasFocus: {
60
61
  type: Boolean,
61
62
  value: false,
62
- observer: '_hasFocusChanged'
63
+ observer: '_hasFocusChanged',
63
64
  },
64
65
 
65
66
  /**
@@ -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
  /**
@@ -77,14 +77,15 @@ export class UserTags extends PolymerElement {
77
77
  */
78
78
  flashing: {
79
79
  type: Boolean,
80
- value: false
80
+ value: false,
81
81
  },
82
82
 
83
83
  /**
84
84
  * A target element that the overlay is positioned to.
85
85
  */
86
86
  target: {
87
- type: Object
87
+ type: Object,
88
+ observer: '__targetChanged',
88
89
  },
89
90
 
90
91
  /**
@@ -92,34 +93,20 @@ export class UserTags extends PolymerElement {
92
93
  */
93
94
  users: {
94
95
  type: Array,
95
- value: () => []
96
+ value: () => [],
96
97
  },
97
98
 
98
99
  /** @private */
99
100
  _flashQueue: {
100
101
  type: Array,
101
- value: () => []
102
- }
102
+ value: () => [],
103
+ },
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
  }
@@ -41,5 +41,5 @@ registerStyles(
41
41
  box-shadow: inset 0 0 0 2px var(--_active-user-color);
42
42
  }
43
43
  `,
44
- { moduleId: 'lumo-field-outline' }
44
+ { moduleId: 'lumo-field-outline' },
45
45
  );
@@ -37,8 +37,8 @@ registerStyles(
37
37
  }
38
38
  `,
39
39
  {
40
- moduleId: 'lumo-user-tags-overlay'
41
- }
40
+ moduleId: 'lumo-user-tags-overlay',
41
+ },
42
42
  );
43
43
 
44
44
  registerStyles(
@@ -60,5 +60,5 @@ registerStyles(
60
60
  min-width: calc(var(--lumo-line-height-xs) * 1em + 0.45em);
61
61
  }
62
62
  `,
63
- { moduleId: 'lumo-user-tag' }
63
+ { moduleId: 'lumo-user-tag' },
64
64
  );
@@ -39,5 +39,5 @@ registerStyles(
39
39
  box-shadow: inset 0 0 0 2px var(--_active-user-color);
40
40
  }
41
41
  `,
42
- { moduleId: 'material-field-outline' }
42
+ { moduleId: 'material-field-outline' },
43
43
  );
@@ -27,5 +27,5 @@ registerStyles(
27
27
  min-width: 1.75em;
28
28
  }
29
29
  `,
30
- { moduleId: 'material-user-tag' }
30
+ { moduleId: 'material-user-tag' },
31
31
  );