@vaadin/field-highlighter 24.6.5 → 24.7.0-alpha10

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.
Files changed (33) hide show
  1. package/package.json +22 -22
  2. package/src/fields/outline.js +5 -1
  3. package/src/fields/vaadin-checkbox-group-observer.js +1 -1
  4. package/src/fields/vaadin-component-observer.js +1 -1
  5. package/src/fields/vaadin-date-picker-observer.js +1 -1
  6. package/src/fields/vaadin-date-time-picker-observer.js +1 -1
  7. package/src/fields/vaadin-field-observer.js +1 -1
  8. package/src/fields/vaadin-list-box-observer.js +1 -1
  9. package/src/fields/vaadin-radio-group-observer.js +1 -1
  10. package/src/fields/vaadin-select-observer.js +1 -1
  11. package/src/vaadin-field-highlighter-styles.d.ts +12 -0
  12. package/src/vaadin-field-highlighter-styles.js +107 -0
  13. package/src/vaadin-field-highlighter.d.ts +1 -1
  14. package/src/vaadin-field-highlighter.js +1 -1
  15. package/src/vaadin-field-outline.js +14 -27
  16. package/src/vaadin-user-tag.js +11 -40
  17. package/src/vaadin-user-tags-overlay.js +13 -55
  18. package/src/vaadin-user-tags.js +36 -42
  19. package/theme/lumo/vaadin-field-highlighter.d.ts +1 -1
  20. package/theme/lumo/vaadin-field-highlighter.js +1 -1
  21. package/theme/lumo/vaadin-field-outline-styles.d.ts +1 -1
  22. package/theme/lumo/vaadin-field-outline-styles.js +1 -1
  23. package/theme/lumo/vaadin-user-tags-styles.d.ts +1 -1
  24. package/theme/lumo/vaadin-user-tags-styles.js +1 -1
  25. package/theme/lumo/vaadin-user-tags.d.ts +1 -1
  26. package/theme/lumo/vaadin-user-tags.js +1 -1
  27. package/theme/material/vaadin-field-highlighter.d.ts +1 -1
  28. package/theme/material/vaadin-field-highlighter.js +1 -1
  29. package/theme/material/vaadin-field-outline-styles.js +1 -1
  30. package/theme/material/vaadin-user-tags-styles.d.ts +1 -1
  31. package/theme/material/vaadin-user-tags-styles.js +1 -1
  32. package/theme/material/vaadin-user-tags.d.ts +1 -1
  33. package/theme/material/vaadin-user-tags.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/field-highlighter",
3
- "version": "24.6.5",
3
+ "version": "24.7.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,31 +34,31 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/a11y-base": "~24.6.5",
38
- "@vaadin/component-base": "~24.6.5",
39
- "@vaadin/overlay": "~24.6.5",
40
- "@vaadin/vaadin-lumo-styles": "~24.6.5",
41
- "@vaadin/vaadin-material-styles": "~24.6.5",
42
- "@vaadin/vaadin-themable-mixin": "~24.6.5",
37
+ "@vaadin/a11y-base": "24.7.0-alpha10",
38
+ "@vaadin/component-base": "24.7.0-alpha10",
39
+ "@vaadin/overlay": "24.7.0-alpha10",
40
+ "@vaadin/vaadin-lumo-styles": "24.7.0-alpha10",
41
+ "@vaadin/vaadin-material-styles": "24.7.0-alpha10",
42
+ "@vaadin/vaadin-themable-mixin": "24.7.0-alpha10",
43
43
  "lit": "^3.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@vaadin/chai-plugins": "~24.6.5",
47
- "@vaadin/checkbox": "~24.6.5",
48
- "@vaadin/checkbox-group": "~24.6.5",
49
- "@vaadin/combo-box": "~24.6.5",
50
- "@vaadin/date-picker": "~24.6.5",
51
- "@vaadin/date-time-picker": "~24.6.5",
52
- "@vaadin/item": "~24.6.5",
53
- "@vaadin/list-box": "~24.6.5",
54
- "@vaadin/radio-group": "~24.6.5",
55
- "@vaadin/select": "~24.6.5",
56
- "@vaadin/test-runner-commands": "~24.6.5",
46
+ "@vaadin/chai-plugins": "24.7.0-alpha10",
47
+ "@vaadin/checkbox": "24.7.0-alpha10",
48
+ "@vaadin/checkbox-group": "24.7.0-alpha10",
49
+ "@vaadin/combo-box": "24.7.0-alpha10",
50
+ "@vaadin/date-picker": "24.7.0-alpha10",
51
+ "@vaadin/date-time-picker": "24.7.0-alpha10",
52
+ "@vaadin/item": "24.7.0-alpha10",
53
+ "@vaadin/list-box": "24.7.0-alpha10",
54
+ "@vaadin/radio-group": "24.7.0-alpha10",
55
+ "@vaadin/select": "24.7.0-alpha10",
56
+ "@vaadin/test-runner-commands": "24.7.0-alpha10",
57
57
  "@vaadin/testing-helpers": "^1.1.0",
58
- "@vaadin/text-area": "~24.6.5",
59
- "@vaadin/text-field": "~24.6.5",
60
- "@vaadin/time-picker": "~24.6.5",
58
+ "@vaadin/text-area": "24.7.0-alpha10",
59
+ "@vaadin/text-field": "24.7.0-alpha10",
60
+ "@vaadin/time-picker": "24.7.0-alpha10",
61
61
  "sinon": "^18.0.0"
62
62
  },
63
- "gitHead": "fc109a4234a1f60e89717ab1c0dc8fb4451aa418"
63
+ "gitHead": "c0f8933df2a6a40648d3fb9cfbae6bbf86a8aa90"
64
64
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -48,6 +48,10 @@ export const initOutline = (field) => {
48
48
 
49
49
  const style = document.createElement('style');
50
50
  style.textContent = `
51
+ :host([focused]) [part="outline"] {
52
+ opacity: calc(1 - var(--lumo-input-field-pointer-focus-visible, 0));
53
+ }
54
+
51
55
  :host([active]) [part="outline"],
52
56
  :host([focus-ring]) [part="outline"] {
53
57
  display: none;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FieldObserver } from './vaadin-field-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { timeOut } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ComponentObserver } from './vaadin-component-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ComponentObserver } from './vaadin-component-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ComponentObserver } from './vaadin-component-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FieldObserver } from './vaadin-field-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FieldObserver } from './vaadin-field-observer.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FieldObserver } from './vaadin-field-observer.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const fieldOutlineStyles: CSSResult;
9
+
10
+ export const userTagStyles: CSSResult;
11
+
12
+ export const userTagsOverlayStyles: CSSResult;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
+
8
+ export const fieldOutlineStyles = css`
9
+ :host {
10
+ display: block;
11
+ box-sizing: border-box;
12
+ position: absolute;
13
+ inset: 0;
14
+ width: 100%;
15
+ height: 100%;
16
+ pointer-events: none;
17
+ user-select: none;
18
+ opacity: 0;
19
+ --_active-user-color: transparent;
20
+ }
21
+
22
+ :host([has-active-user]) {
23
+ opacity: 1;
24
+ }
25
+ `;
26
+
27
+ export const userTagStyles = css`
28
+ :host {
29
+ display: block;
30
+ box-sizing: border-box;
31
+ margin: 0 0 var(--vaadin-user-tag-offset);
32
+ opacity: 0;
33
+ height: 1.3rem;
34
+ transition: opacity 0.2s ease-in-out;
35
+ background-color: var(--vaadin-user-tag-color);
36
+ color: #fff;
37
+ cursor: default;
38
+ -webkit-user-select: none;
39
+ user-select: none;
40
+ --vaadin-user-tag-offset: 4px;
41
+ }
42
+
43
+ :host(.show) {
44
+ opacity: 1;
45
+ }
46
+
47
+ :host(:last-of-type) {
48
+ margin-bottom: 0;
49
+ }
50
+
51
+ [part='name'] {
52
+ overflow: hidden;
53
+ white-space: nowrap;
54
+ text-overflow: ellipsis;
55
+ box-sizing: border-box;
56
+ padding: 2px 4px;
57
+ height: 1.3rem;
58
+ font-size: 13px;
59
+ }
60
+ `;
61
+
62
+ export const userTagsOverlayStyles = css`
63
+ :host {
64
+ background: transparent;
65
+ box-shadow: none;
66
+ }
67
+
68
+ :scope [part='overlay'] {
69
+ box-shadow: none;
70
+ background: transparent;
71
+ position: relative;
72
+ left: -4px;
73
+ padding: 4px;
74
+ outline: none;
75
+ overflow: visible;
76
+ }
77
+
78
+ ::slotted([part='tags']) {
79
+ display: flex;
80
+ flex-direction: column;
81
+ align-items: flex-start;
82
+ }
83
+
84
+ :host([dir='rtl']) [part='overlay'] {
85
+ left: auto;
86
+ right: -4px;
87
+ }
88
+
89
+ :scope [part='content'] {
90
+ padding: 0;
91
+ }
92
+
93
+ :host([opening]),
94
+ :host([closing]) {
95
+ animation: 0.14s user-tags-overlay-dummy-animation;
96
+ }
97
+
98
+ @keyframes user-tags-overlay-dummy-animation {
99
+ 0% {
100
+ opacity: 1;
101
+ }
102
+
103
+ 100% {
104
+ opacity: 1;
105
+ }
106
+ }
107
+ `;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { ReactiveController } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-field-outline.js';
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 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, PolymerElement } from '@polymer/polymer/polymer-element.js';
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 { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { fieldOutlineStyles } from './vaadin-field-highlighter-styles.js';
12
+
13
+ registerStyles('vaadin-field-outline', fieldOutlineStyles, { moduleId: 'vaadin-field-outline-styles' });
10
14
 
11
15
  /**
12
16
  * An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
@@ -16,34 +20,11 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
16
20
  * @mixes ThemableMixin
17
21
  * @private
18
22
  */
19
- export class FieldOutline extends ThemableMixin(DirMixin(PolymerElement)) {
23
+ export class FieldOutline extends ThemableMixin(DirMixin(PolylitMixin(LitElement))) {
20
24
  static get is() {
21
25
  return 'vaadin-field-outline';
22
26
  }
23
27
 
24
- static get template() {
25
- return html`
26
- <style>
27
- :host {
28
- display: block;
29
- box-sizing: border-box;
30
- position: absolute;
31
- inset: 0;
32
- width: 100%;
33
- height: 100%;
34
- pointer-events: none;
35
- user-select: none;
36
- opacity: 0;
37
- --_active-user-color: transparent;
38
- }
39
-
40
- :host([has-active-user]) {
41
- opacity: 1;
42
- }
43
- </style>
44
- `;
45
- }
46
-
47
28
  static get properties() {
48
29
  return {
49
30
  /**
@@ -53,10 +34,16 @@ export class FieldOutline extends ThemableMixin(DirMixin(PolymerElement)) {
53
34
  type: Object,
54
35
  value: null,
55
36
  observer: '_userChanged',
37
+ sync: true,
56
38
  },
57
39
  };
58
40
  }
59
41
 
42
+ /** @protected */
43
+ render() {
44
+ return html``;
45
+ }
46
+
60
47
  /** @protected */
61
48
  ready() {
62
49
  super.ready();
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 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, PolymerElement } from '@polymer/polymer/polymer-element.js';
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 { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { userTagStyles } from './vaadin-field-highlighter-styles.js';
10
12
 
11
13
  /**
12
14
  * An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
@@ -17,49 +19,18 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
17
19
  * @mixes ThemableMixin
18
20
  * @private
19
21
  */
20
- export class UserTag extends ThemableMixin(DirMixin(PolymerElement)) {
22
+ export class UserTag extends ThemableMixin(DirMixin(PolylitMixin(LitElement))) {
21
23
  static get is() {
22
24
  return 'vaadin-user-tag';
23
25
  }
24
26
 
25
- static get template() {
26
- return html`
27
- <style>
28
- :host {
29
- display: block;
30
- box-sizing: border-box;
31
- margin: 0 0 var(--vaadin-user-tag-offset);
32
- opacity: 0;
33
- height: 1.3rem;
34
- transition: opacity 0.2s ease-in-out;
35
- background-color: var(--vaadin-user-tag-color);
36
- color: #fff;
37
- cursor: default;
38
- -webkit-user-select: none;
39
- user-select: none;
40
- --vaadin-user-tag-offset: 4px;
41
- }
42
-
43
- :host(.show) {
44
- opacity: 1;
45
- }
46
-
47
- :host(:last-of-type) {
48
- margin-bottom: 0;
49
- }
27
+ static get styles() {
28
+ return userTagStyles;
29
+ }
50
30
 
51
- [part='name'] {
52
- overflow: hidden;
53
- white-space: nowrap;
54
- text-overflow: ellipsis;
55
- box-sizing: border-box;
56
- padding: 2px 4px;
57
- height: 1.3rem;
58
- font-size: 13px;
59
- }
60
- </style>
61
- <div part="name">[[name]]</div>
62
- `;
31
+ /** @protected */
32
+ render() {
33
+ return html`<div part="name">${this.name}</div>`;
63
34
  }
64
35
 
65
36
  static get properties() {
@@ -1,64 +1,17 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 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, PolymerElement } from '@polymer/polymer/polymer-element.js';
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 { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
10
11
  import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
11
12
  import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
12
- import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
-
14
- const userTagsOverlayStyles = css`
15
- :host {
16
- background: transparent;
17
- box-shadow: none;
18
- }
19
-
20
- [part='overlay'] {
21
- box-shadow: none;
22
- background: transparent;
23
- position: relative;
24
- left: -4px;
25
- padding: 4px;
26
- outline: none;
27
- overflow: visible;
28
- }
29
-
30
- ::slotted([part='tags']) {
31
- display: flex;
32
- flex-direction: column;
33
- align-items: flex-start;
34
- }
35
-
36
- :host([dir='rtl']) [part='overlay'] {
37
- left: auto;
38
- right: -4px;
39
- }
40
-
41
- [part='content'] {
42
- padding: 0;
43
- }
44
-
45
- :host([opening]),
46
- :host([closing]) {
47
- animation: 0.14s user-tags-overlay-dummy-animation;
48
- }
49
-
50
- @keyframes user-tags-overlay-dummy-animation {
51
- 0% {
52
- opacity: 1;
53
- }
54
-
55
- 100% {
56
- opacity: 1;
57
- }
58
- }
59
- `;
60
-
61
- registerStyles('vaadin-user-tags-overlay', [overlayStyles, userTagsOverlayStyles]);
13
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { userTagsOverlayStyles } from './vaadin-field-highlighter-styles.js';
62
15
 
63
16
  /**
64
17
  * An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
@@ -71,14 +24,19 @@ registerStyles('vaadin-user-tags-overlay', [overlayStyles, userTagsOverlayStyles
71
24
  * @mixes ThemableMixin
72
25
  * @private
73
26
  */
74
- class UserTagsOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableMixin(PolymerElement)))) {
27
+ class UserTagsOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement))))) {
75
28
  static get is() {
76
29
  return 'vaadin-user-tags-overlay';
77
30
  }
78
31
 
79
- static get template() {
32
+ static get styles() {
33
+ return [overlayStyles, userTagsOverlayStyles];
34
+ }
35
+
36
+ /** @protected */
37
+ render() {
80
38
  return html`
81
- <div id="backdrop" part="backdrop" hidden$="[[!withBackdrop]]"></div>
39
+ <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
82
40
  <div part="overlay" id="overlay">
83
41
  <div part="content" id="content">
84
42
  <slot></slot>
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-user-tag.js';
7
7
  import './vaadin-user-tags-overlay.js';
8
- import { calculateSplices } from '@polymer/polymer/lib/utils/array-splice.js';
9
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
+ import { css, html, LitElement } from 'lit';
10
9
  import { timeOut } from '@vaadin/component-base/src/async.js';
11
10
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
12
11
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
12
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
13
 
14
14
  const listenOnce = (elem, type) => {
15
15
  return new Promise((resolve) => {
@@ -28,24 +28,28 @@ const listenOnce = (elem, type) => {
28
28
  * @extends HTMLElement
29
29
  * @private
30
30
  */
31
- export class UserTags extends PolymerElement {
31
+ export class UserTags extends PolylitMixin(LitElement) {
32
32
  static get is() {
33
33
  return 'vaadin-user-tags';
34
34
  }
35
35
 
36
- static get template() {
36
+ static get styles() {
37
+ return css`
38
+ :host {
39
+ position: absolute;
40
+ }
41
+ `;
42
+ }
43
+
44
+ /** @protected */
45
+ render() {
37
46
  return html`
38
- <style>
39
- :host {
40
- position: absolute;
41
- }
42
- </style>
43
47
  <vaadin-user-tags-overlay
44
48
  id="overlay"
45
49
  modeless
46
- opened="[[opened]]"
50
+ .opened="${this.opened}"
47
51
  no-vertical-overlap
48
- on-vaadin-overlay-open="_onOverlayOpen"
52
+ @vaadin-overlay-open="${this._onOverlayOpen}"
49
53
  ></vaadin-user-tags-overlay>
50
54
  `;
51
55
  }
@@ -68,6 +72,7 @@ export class UserTags extends PolymerElement {
68
72
  opened: {
69
73
  type: Boolean,
70
74
  value: false,
75
+ sync: true,
71
76
  },
72
77
 
73
78
  /**
@@ -233,27 +238,6 @@ export class UserTags extends PolymerElement {
233
238
  return { added, removed };
234
239
  }
235
240
 
236
- getChangedUsers(users, splices) {
237
- const usersToAdd = [];
238
- const usersToRemove = [];
239
-
240
- splices.forEach((splice) => {
241
- splice.removed.forEach((user) => {
242
- usersToRemove.push(user);
243
- });
244
-
245
- for (let i = splice.addedCount - 1; i >= 0; i--) {
246
- usersToAdd.push(users[splice.index + i]);
247
- }
248
- });
249
-
250
- // Filter out users that are only moved
251
- const addedUsers = usersToAdd.filter((u) => !usersToRemove.some((u2) => u.id === u2.id));
252
- const removedUsers = usersToRemove.filter((u) => !usersToAdd.some((u2) => u.id === u2.id));
253
-
254
- return { addedUsers, removedUsers };
255
- }
256
-
257
241
  applyTagsStart({ added, removed }) {
258
242
  const wrapper = this.wrapper;
259
243
  removed.forEach((tag) => {
@@ -279,12 +263,22 @@ export class UserTags extends PolymerElement {
279
263
  // Apply pending change if needed
280
264
  this.requestContentUpdate();
281
265
 
282
- const splices = calculateSplices(users, this.users);
283
- if (splices.length === 0) {
284
- return;
266
+ let addedUsers = [];
267
+ let removedUsers = [];
268
+
269
+ const hasNewUsers = Array.isArray(users);
270
+ const hasOldUsers = Array.isArray(this.users);
271
+
272
+ if (hasOldUsers) {
273
+ const newUserIds = (users || []).map((user) => user.id);
274
+ removedUsers = this.users.filter((item) => !newUserIds.includes(item.id));
275
+ }
276
+
277
+ if (hasNewUsers) {
278
+ const oldUserIds = (this.users || []).map((user) => user.id);
279
+ addedUsers = users.filter((item) => !oldUserIds.includes(item.id)).reverse();
285
280
  }
286
281
 
287
- const { addedUsers, removedUsers } = this.getChangedUsers(users, splices);
288
282
  if (addedUsers.length === 0 && removedUsers.length === 0) {
289
283
  return;
290
284
  }
@@ -300,7 +294,7 @@ export class UserTags extends PolymerElement {
300
294
 
301
295
  this.__flashQueue.forEach((tags) => {
302
296
  if (tags.some((tag) => tag.uid === user.id)) {
303
- this.splice('__flashQueue', i, 1);
297
+ this.__flashQueue = this.__flashQueue.filter((_, index) => index !== i);
304
298
  }
305
299
  });
306
300
  });
@@ -323,7 +317,7 @@ export class UserTags extends PolymerElement {
323
317
 
324
318
  if (this.flashing || !this.__isTargetVisible) {
325
319
  // Schedule next flash later
326
- this.push('__flashQueue', addedTags);
320
+ this.__flashQueue = [...this.__flashQueue, addedTags];
327
321
  } else {
328
322
  this.flashTags(addedTags);
329
323
  }
@@ -394,7 +388,7 @@ export class UserTags extends PolymerElement {
394
388
  }).then(() => {
395
389
  if (this.__flashQueue.length > 0) {
396
390
  const tags = this.__flashQueue[0];
397
- this.splice('__flashQueue', 0, 1);
391
+ this.__flashQueue = [...this.__flashQueue].slice(1);
398
392
  this.flashTags(tags);
399
393
  }
400
394
  });
@@ -416,7 +410,7 @@ export class UserTags extends PolymerElement {
416
410
  this.applyTagsStart(changed);
417
411
 
418
412
  this._debounceRender = Debouncer.debounce(this._debounceRender, timeOut.after(this.duration), () => {
419
- this.set('users', users);
413
+ this.users = users;
420
414
 
421
415
  this.applyTagsEnd(changed);
422
416
 
@@ -428,7 +422,7 @@ export class UserTags extends PolymerElement {
428
422
 
429
423
  updateTagsSync(users, changed) {
430
424
  this.applyTagsStart(changed);
431
- this.set('users', users);
425
+ this.users = users;
432
426
  this.applyTagsEnd(changed);
433
427
  }
434
428
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/user-colors.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/user-colors.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/spacing.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/spacing.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/color.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/color.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-user-tags-styles.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-user-tags-styles.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-material-styles/user-colors.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-material-styles/user-colors.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-material-styles/color.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-material-styles/color.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-user-tags-styles.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2024 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-user-tags-styles.js';