@vaadin/field-highlighter 25.0.0-alpha2 → 25.0.0-alpha20
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 +21 -23
- package/src/fields/outline.js +1 -6
- package/src/fields/vaadin-date-picker-observer.js +20 -18
- package/src/fields/vaadin-select-observer.js +12 -18
- package/{theme/lumo/vaadin-user-tags.js → src/styles/vaadin-field-outline-base-styles.d.ts} +3 -2
- package/src/styles/vaadin-field-outline-base-styles.js +30 -0
- package/{theme/lumo/vaadin-user-tags.d.ts → src/styles/vaadin-user-tag-base-styles.d.ts} +3 -2
- package/src/styles/vaadin-user-tag-base-styles.js +36 -0
- package/src/{vaadin-field-highlighter-styles.d.ts → styles/vaadin-user-tags-overlay-base-styles.d.ts} +0 -4
- package/src/styles/vaadin-user-tags-overlay-base-styles.js +40 -0
- package/src/vaadin-field-outline.js +8 -5
- package/src/vaadin-user-tag.js +3 -2
- package/src/vaadin-user-tags-overlay.js +6 -5
- package/src/vaadin-user-tags.js +16 -21
- package/vaadin-field-highlighter.js +1 -1
- package/src/vaadin-field-highlighter-styles.js +0 -107
- package/theme/lumo/vaadin-field-highlighter.d.ts +0 -9
- package/theme/lumo/vaadin-field-highlighter.js +0 -9
- package/theme/lumo/vaadin-field-outline-styles.d.ts +0 -7
- package/theme/lumo/vaadin-field-outline-styles.js +0 -46
- package/theme/lumo/vaadin-user-tags-styles.d.ts +0 -9
- package/theme/lumo/vaadin-user-tags-styles.js +0 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-highlighter",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"theme",
|
|
25
24
|
"vaadin-*.d.ts",
|
|
26
25
|
"vaadin-*.js"
|
|
27
26
|
],
|
|
@@ -33,30 +32,29 @@
|
|
|
33
32
|
"field"
|
|
34
33
|
],
|
|
35
34
|
"dependencies": {
|
|
36
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
37
|
-
"@vaadin/component-base": "25.0.0-
|
|
38
|
-
"@vaadin/overlay": "25.0.0-
|
|
39
|
-
"@vaadin/vaadin-
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
35
|
+
"@vaadin/a11y-base": "25.0.0-alpha20",
|
|
36
|
+
"@vaadin/component-base": "25.0.0-alpha20",
|
|
37
|
+
"@vaadin/overlay": "25.0.0-alpha20",
|
|
38
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha20",
|
|
41
39
|
"lit": "^3.0.0"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
45
|
-
"@vaadin/checkbox": "25.0.0-
|
|
46
|
-
"@vaadin/checkbox-group": "25.0.0-
|
|
47
|
-
"@vaadin/
|
|
48
|
-
"@vaadin/date-picker": "25.0.0-
|
|
49
|
-
"@vaadin/
|
|
50
|
-
"@vaadin/
|
|
51
|
-
"@vaadin/
|
|
52
|
-
"@vaadin/
|
|
53
|
-
"@vaadin/
|
|
54
|
-
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
42
|
+
"@vaadin/chai-plugins": "25.0.0-alpha20",
|
|
43
|
+
"@vaadin/checkbox": "25.0.0-alpha20",
|
|
44
|
+
"@vaadin/checkbox-group": "25.0.0-alpha20",
|
|
45
|
+
"@vaadin/date-picker": "25.0.0-alpha20",
|
|
46
|
+
"@vaadin/date-time-picker": "25.0.0-alpha20",
|
|
47
|
+
"@vaadin/item": "25.0.0-alpha20",
|
|
48
|
+
"@vaadin/list-box": "25.0.0-alpha20",
|
|
49
|
+
"@vaadin/radio-group": "25.0.0-alpha20",
|
|
50
|
+
"@vaadin/select": "25.0.0-alpha20",
|
|
51
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha20",
|
|
55
52
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
56
|
-
"@vaadin/text-area": "25.0.0-
|
|
57
|
-
"@vaadin/text-field": "25.0.0-
|
|
58
|
-
"@vaadin/time-picker": "25.0.0-
|
|
59
|
-
"
|
|
53
|
+
"@vaadin/text-area": "25.0.0-alpha20",
|
|
54
|
+
"@vaadin/text-field": "25.0.0-alpha20",
|
|
55
|
+
"@vaadin/time-picker": "25.0.0-alpha20",
|
|
56
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha20",
|
|
57
|
+
"sinon": "^21.0.0"
|
|
60
58
|
},
|
|
61
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "c948aae591a30b432f3784000d4677674cae56e0"
|
|
62
60
|
}
|
package/src/fields/outline.js
CHANGED
|
@@ -48,12 +48,7 @@ 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
|
-
|
|
55
|
-
:host([active]) [part="outline"],
|
|
56
|
-
:host([focus-ring]) [part="outline"] {
|
|
51
|
+
:host(:is([active], [focused])) [part="outline"] {
|
|
57
52
|
display: none;
|
|
58
53
|
}
|
|
59
54
|
`;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
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 { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
6
7
|
import { ComponentObserver } from './vaadin-component-observer.js';
|
|
7
8
|
|
|
8
9
|
export class DatePickerObserver extends ComponentObserver {
|
|
@@ -10,7 +11,6 @@ export class DatePickerObserver extends ComponentObserver {
|
|
|
10
11
|
super(datePicker);
|
|
11
12
|
|
|
12
13
|
this.datePicker = datePicker;
|
|
13
|
-
this.fullscreenFocus = false;
|
|
14
14
|
this.blurWhileOpened = false;
|
|
15
15
|
|
|
16
16
|
this.addListeners(datePicker);
|
|
@@ -19,14 +19,6 @@ export class DatePickerObserver extends ComponentObserver {
|
|
|
19
19
|
addListeners(datePicker) {
|
|
20
20
|
this.overlay = datePicker.$.overlay;
|
|
21
21
|
|
|
22
|
-
// Fullscreen date picker calls blur() to avoid focusing of the input:
|
|
23
|
-
// 1. first time when focus event is fired (before opening the overlay),
|
|
24
|
-
// 2. second time after the overlay is open, see "_onOverlayOpened".
|
|
25
|
-
// Here we set the flag to ignore related focusout events and then to
|
|
26
|
-
// mark date picker as being edited by user (to show field highlight).
|
|
27
|
-
// We have to use capture phase in order to catch this event early.
|
|
28
|
-
datePicker.addEventListener('blur', (event) => this.onBlur(event), true);
|
|
29
|
-
|
|
30
22
|
datePicker.addEventListener('opened-changed', (event) => this.onOpenedChanged(event));
|
|
31
23
|
|
|
32
24
|
this.overlay.addEventListener('focusout', (event) => this.onOverlayFocusOut(event));
|
|
@@ -40,14 +32,17 @@ export class DatePickerObserver extends ComponentObserver {
|
|
|
40
32
|
return this.datePicker._overlayContent && this.datePicker._overlayContent.contains(node);
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
isFullscreen() {
|
|
44
36
|
const datePicker = this.datePicker;
|
|
45
|
-
|
|
46
|
-
this.fullscreenFocus = true;
|
|
47
|
-
}
|
|
37
|
+
return datePicker._noInput && !isKeyboardActive();
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
onFocusIn(event) {
|
|
41
|
+
if (this.isEventInOverlay(event.target)) {
|
|
42
|
+
// Focus moves to the overlay, do nothing.
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
51
46
|
if (this.isEventInOverlay(event.relatedTarget)) {
|
|
52
47
|
// Focus returns from the overlay, do nothing.
|
|
53
48
|
return;
|
|
@@ -63,9 +58,17 @@ export class DatePickerObserver extends ComponentObserver {
|
|
|
63
58
|
}
|
|
64
59
|
|
|
65
60
|
onFocusOut(event) {
|
|
66
|
-
if (this.
|
|
67
|
-
//
|
|
68
|
-
|
|
61
|
+
if (this.isEventInOverlay(event.target) && this.component.contains(event.relatedTarget)) {
|
|
62
|
+
// Focus returns from the overlay, do nothing.
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.isEventInOverlay(event.relatedTarget)) {
|
|
67
|
+
// Focus moves to the overlay, do nothing.
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!this.datePicker.opened) {
|
|
69
72
|
// Field blur when closed.
|
|
70
73
|
this.hideOutline(this.datePicker);
|
|
71
74
|
} else {
|
|
@@ -83,8 +86,7 @@ export class DatePickerObserver extends ComponentObserver {
|
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
onOpenedChanged(event) {
|
|
86
|
-
if (event.detail.value === true && this.
|
|
87
|
-
this.fullscreenFocus = false;
|
|
89
|
+
if (event.detail.value === true && this.isFullscreen()) {
|
|
88
90
|
this.showOutline(this.datePicker);
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -9,29 +9,17 @@ export class SelectObserver extends FieldObserver {
|
|
|
9
9
|
constructor(select) {
|
|
10
10
|
super(select);
|
|
11
11
|
|
|
12
|
-
this.blurWhileOpened = false;
|
|
13
12
|
this.overlay = select._overlayElement;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
addListeners(select) {
|
|
17
|
-
super.addListeners(select);
|
|
18
|
-
|
|
19
|
-
select.addEventListener('opened-changed', (event) => {
|
|
20
|
-
// When in phone mode, focus is lost when closing.
|
|
21
|
-
if (select._phone && event.detail.value === false) {
|
|
22
|
-
this.hideOutline(select);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
15
|
onFocusIn(event) {
|
|
28
|
-
if (this.overlay.contains(event.
|
|
29
|
-
// Focus
|
|
16
|
+
if (this.overlay._contentRoot.contains(event.target)) {
|
|
17
|
+
// Focus moves to the overlay item, do nothing.
|
|
30
18
|
return;
|
|
31
19
|
}
|
|
32
20
|
|
|
33
|
-
if (
|
|
34
|
-
// Focus returns on
|
|
21
|
+
if (this.overlay._contentRoot.contains(event.relatedTarget)) {
|
|
22
|
+
// Focus returns on item select, do nothing.
|
|
35
23
|
return;
|
|
36
24
|
}
|
|
37
25
|
|
|
@@ -39,10 +27,16 @@ export class SelectObserver extends FieldObserver {
|
|
|
39
27
|
}
|
|
40
28
|
|
|
41
29
|
onFocusOut(event) {
|
|
42
|
-
if (this.overlay.contains(event.relatedTarget)) {
|
|
43
|
-
//
|
|
30
|
+
if (this.overlay._contentRoot.contains(event.relatedTarget)) {
|
|
31
|
+
// Focus moves to the overlay on opening, do nothing.
|
|
44
32
|
return;
|
|
45
33
|
}
|
|
34
|
+
|
|
35
|
+
if (this.overlay._contentRoot.contains(event.target) && this.component.contains(event.relatedTarget)) {
|
|
36
|
+
// Focus returns from the overlay on closing, do nothing.
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
46
40
|
super.onFocusOut(event);
|
|
47
41
|
}
|
|
48
42
|
}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
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 '
|
|
7
|
-
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const fieldOutlineStyles: CSSResult;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 '@vaadin/component-base/src/styles/user-colors.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const fieldOutlineStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
position: absolute;
|
|
13
|
+
inset: 0;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
opacity: 0;
|
|
16
|
+
--_active-user-color: transparent;
|
|
17
|
+
outline: 3px solid var(--_active-user-color);
|
|
18
|
+
outline-offset: -1px;
|
|
19
|
+
/* TODO doesn't inherit correctly from vaadin-input-container for some reason, so we use the internal _radius property */
|
|
20
|
+
border-radius: var(--_radius, inherit);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([has-active-user]) {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([context$='item']) {
|
|
28
|
+
inset: 2px;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -3,5 +3,6 @@
|
|
|
3
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 '
|
|
7
|
-
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const userTagStyles: CSSResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 '@vaadin/component-base/src/styles/style-props.js';
|
|
7
|
+
import '@vaadin/component-base/src/styles/user-colors.js';
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
export const userTagStyles = css`
|
|
11
|
+
:host {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
padding: var(--vaadin-user-tag-padding, 0.3em);
|
|
16
|
+
background-color: var(--vaadin-user-tag-color);
|
|
17
|
+
color: oklch(from var(--vaadin-user-tag-color) clamp(0, (0.62 - l) * 1000, 1) 0 0);
|
|
18
|
+
font-size: var(--vaadin-user-tag-font-size, 0.75em);
|
|
19
|
+
font-weight: var(--vaadin-user-tag-font-weight, 500);
|
|
20
|
+
line-height: var(--vaadin-user-tag-line-height, 1);
|
|
21
|
+
border: var(--vaadin-user-tag-border-width, 0) solid
|
|
22
|
+
var(--vaadin-user-tag-border-color, var(--vaadin-border-color-secondary));
|
|
23
|
+
border-radius: var(--vaadin-user-tag-border-radius, var(--vaadin-radius-m));
|
|
24
|
+
cursor: default;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host(.show) {
|
|
28
|
+
opacity: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[part='name'] {
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 'lit';
|
|
7
|
+
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
|
|
8
|
+
|
|
9
|
+
const userTagsOverlay = css`
|
|
10
|
+
[part='overlay'] {
|
|
11
|
+
all: initial;
|
|
12
|
+
display: block;
|
|
13
|
+
font: inherit;
|
|
14
|
+
color: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[part='content'] {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
gap: var(--vaadin-user-tag-overlay-gap, 0.2em);
|
|
21
|
+
padding: 0.5em 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([opening]),
|
|
25
|
+
:host([closing]) {
|
|
26
|
+
animation: 0.14s user-tags-overlay-dummy-animation;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes user-tags-overlay-dummy-animation {
|
|
30
|
+
0% {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
100% {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const userTagsOverlayStyles = [overlayStyles, userTagsOverlay];
|
|
@@ -7,10 +7,9 @@ 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
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
registerStyles('vaadin-field-outline', fieldOutlineStyles, { moduleId: 'vaadin-field-outline-styles' });
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { fieldOutlineStyles } from './styles/vaadin-field-outline-base-styles.js';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
|
|
@@ -20,11 +19,15 @@ registerStyles('vaadin-field-outline', fieldOutlineStyles, { moduleId: 'vaadin-f
|
|
|
20
19
|
* @mixes ThemableMixin
|
|
21
20
|
* @private
|
|
22
21
|
*/
|
|
23
|
-
export class FieldOutline extends ThemableMixin(DirMixin(PolylitMixin(LitElement))) {
|
|
22
|
+
export class FieldOutline extends ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
|
|
24
23
|
static get is() {
|
|
25
24
|
return 'vaadin-field-outline';
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
static get styles() {
|
|
28
|
+
return fieldOutlineStyles;
|
|
29
|
+
}
|
|
30
|
+
|
|
28
31
|
static get properties() {
|
|
29
32
|
return {
|
|
30
33
|
/**
|
package/src/vaadin-user-tag.js
CHANGED
|
@@ -7,8 +7,9 @@ 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
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { userTagStyles } from './vaadin-
|
|
12
|
+
import { userTagStyles } from './styles/vaadin-user-tag-base-styles.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
|
|
@@ -19,7 +20,7 @@ import { userTagStyles } from './vaadin-field-highlighter-styles.js';
|
|
|
19
20
|
* @mixes ThemableMixin
|
|
20
21
|
* @private
|
|
21
22
|
*/
|
|
22
|
-
export class UserTag extends ThemableMixin(DirMixin(PolylitMixin(LitElement))) {
|
|
23
|
+
export class UserTag extends ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
|
|
23
24
|
static get is() {
|
|
24
25
|
return 'vaadin-user-tag';
|
|
25
26
|
}
|
|
@@ -9,9 +9,9 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
10
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
11
|
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
12
|
-
import {
|
|
12
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
-
import { userTagsOverlayStyles } from './vaadin-
|
|
14
|
+
import { userTagsOverlayStyles } from './styles/vaadin-user-tags-overlay-base-styles.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* An element used internally by `<vaadin-field-highlighter>`. Not intended to be used separately.
|
|
@@ -24,19 +24,20 @@ import { userTagsOverlayStyles } from './vaadin-field-highlighter-styles.js';
|
|
|
24
24
|
* @mixes ThemableMixin
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
|
-
class UserTagsOverlay extends PositionMixin(
|
|
27
|
+
class UserTagsOverlay extends PositionMixin(
|
|
28
|
+
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
|
|
29
|
+
) {
|
|
28
30
|
static get is() {
|
|
29
31
|
return 'vaadin-user-tags-overlay';
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
static get styles() {
|
|
33
|
-
return
|
|
35
|
+
return userTagsOverlayStyles;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/** @protected */
|
|
37
39
|
render() {
|
|
38
40
|
return html`
|
|
39
|
-
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
40
41
|
<div part="overlay" id="overlay">
|
|
41
42
|
<div part="content" id="content">
|
|
42
43
|
<slot></slot>
|
package/src/vaadin-user-tags.js
CHANGED
|
@@ -46,11 +46,14 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
46
46
|
return html`
|
|
47
47
|
<vaadin-user-tags-overlay
|
|
48
48
|
id="overlay"
|
|
49
|
+
exportparts="overlay:user-tags-overlay, content:user-tags-content"
|
|
49
50
|
modeless
|
|
50
51
|
.opened="${this.opened}"
|
|
51
52
|
no-vertical-overlap
|
|
52
53
|
@vaadin-overlay-open="${this._onOverlayOpen}"
|
|
53
|
-
|
|
54
|
+
>
|
|
55
|
+
<slot></slot>
|
|
56
|
+
</vaadin-user-tags-overlay>
|
|
54
57
|
`;
|
|
55
58
|
}
|
|
56
59
|
|
|
@@ -137,7 +140,8 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
137
140
|
|
|
138
141
|
/** @protected */
|
|
139
142
|
get wrapper() {
|
|
140
|
-
|
|
143
|
+
// Used by Collaboration Kit util
|
|
144
|
+
return this;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
/** @protected */
|
|
@@ -162,15 +166,8 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
162
166
|
ready() {
|
|
163
167
|
super.ready();
|
|
164
168
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const tags = document.createElement('div');
|
|
168
|
-
tags.setAttribute('part', 'tags');
|
|
169
|
-
root.appendChild(tags);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
this.$.overlay.requestContentUpdate();
|
|
169
|
+
// Export user tags overlay parts for styling
|
|
170
|
+
this.setAttribute('exportparts', 'user-tags-overlay, user-tags-content');
|
|
174
171
|
}
|
|
175
172
|
|
|
176
173
|
/** @private */
|
|
@@ -222,6 +219,7 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
222
219
|
|
|
223
220
|
createUserTag(user) {
|
|
224
221
|
const tag = document.createElement('vaadin-user-tag');
|
|
222
|
+
tag.setAttribute('part', 'user-tag');
|
|
225
223
|
tag.name = user.name;
|
|
226
224
|
tag.uid = user.id;
|
|
227
225
|
tag.colorIndex = user.colorIndex;
|
|
@@ -229,7 +227,7 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
229
227
|
}
|
|
230
228
|
|
|
231
229
|
getTagForUser(user) {
|
|
232
|
-
return Array.from(this.
|
|
230
|
+
return Array.from(this.children).find((tag) => tag.uid === user.id);
|
|
233
231
|
}
|
|
234
232
|
|
|
235
233
|
getChangedTags(addedUsers, removedUsers) {
|
|
@@ -239,21 +237,19 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
239
237
|
}
|
|
240
238
|
|
|
241
239
|
applyTagsStart({ added, removed }) {
|
|
242
|
-
const wrapper = this.wrapper;
|
|
243
240
|
removed.forEach((tag) => {
|
|
244
241
|
if (tag) {
|
|
245
242
|
tag.classList.add('removing');
|
|
246
243
|
tag.classList.remove('show');
|
|
247
244
|
}
|
|
248
245
|
});
|
|
249
|
-
added.forEach((tag) =>
|
|
246
|
+
added.forEach((tag) => this.insertBefore(tag, this.firstChild));
|
|
250
247
|
}
|
|
251
248
|
|
|
252
249
|
applyTagsEnd({ added, removed }) {
|
|
253
|
-
const wrapper = this.wrapper;
|
|
254
250
|
removed.forEach((tag) => {
|
|
255
|
-
if (tag && tag.parentNode ===
|
|
256
|
-
|
|
251
|
+
if (tag && tag.parentNode === this) {
|
|
252
|
+
this.removeChild(tag);
|
|
257
253
|
}
|
|
258
254
|
});
|
|
259
255
|
added.forEach((tag) => tag && tag.classList.add('show'));
|
|
@@ -329,7 +325,7 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
329
325
|
/** @private */
|
|
330
326
|
_onOverlayOpen() {
|
|
331
327
|
// Animate all tags except removing ones
|
|
332
|
-
Array.from(this.
|
|
328
|
+
Array.from(this.children).forEach((tag) => {
|
|
333
329
|
if (!tag.classList.contains('removing')) {
|
|
334
330
|
tag.classList.add('show');
|
|
335
331
|
}
|
|
@@ -338,17 +334,16 @@ export class UserTags extends PolylitMixin(LitElement) {
|
|
|
338
334
|
|
|
339
335
|
flashTags(added) {
|
|
340
336
|
this.flashing = true;
|
|
341
|
-
const wrapper = this.wrapper;
|
|
342
337
|
|
|
343
338
|
// Hide existing tags
|
|
344
|
-
const hidden = Array.from(
|
|
339
|
+
const hidden = Array.from(this.children);
|
|
345
340
|
hidden.forEach((tag) => {
|
|
346
341
|
tag.style.display = 'none';
|
|
347
342
|
});
|
|
348
343
|
|
|
349
344
|
// Render new tags
|
|
350
345
|
added.forEach((tag) => {
|
|
351
|
-
|
|
346
|
+
this.insertBefore(tag, this.firstChild);
|
|
352
347
|
});
|
|
353
348
|
|
|
354
349
|
this.flashPromise = new Promise((resolve) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-field-highlighter.js';
|
|
2
2
|
export * from './src/vaadin-field-highlighter.js';
|
|
@@ -1,107 +0,0 @@
|
|
|
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,9 +0,0 @@
|
|
|
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 '@vaadin/vaadin-lumo-styles/user-colors.js';
|
|
7
|
-
import './vaadin-field-outline-styles.js';
|
|
8
|
-
import './vaadin-user-tags.js';
|
|
9
|
-
import '../../src/vaadin-field-highlighter.js';
|
|
@@ -1,9 +0,0 @@
|
|
|
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 '@vaadin/vaadin-lumo-styles/user-colors.js';
|
|
7
|
-
import './vaadin-field-outline-styles.js';
|
|
8
|
-
import './vaadin-user-tags.js';
|
|
9
|
-
import '../../src/vaadin-field-highlighter.js';
|
|
@@ -1,46 +0,0 @@
|
|
|
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 '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
7
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
8
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
|
|
10
|
-
registerStyles(
|
|
11
|
-
'vaadin-field-outline',
|
|
12
|
-
css`
|
|
13
|
-
:host {
|
|
14
|
-
transition: opacity 0.3s;
|
|
15
|
-
-webkit-mask-image: none !important;
|
|
16
|
-
mask-image: none !important;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:host::before {
|
|
20
|
-
content: '';
|
|
21
|
-
position: absolute;
|
|
22
|
-
inset: 0;
|
|
23
|
-
box-shadow: 0 0 0 2px var(--_active-user-color);
|
|
24
|
-
border-radius: var(--lumo-border-radius-s);
|
|
25
|
-
transition: box-shadow 0.3s;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:host([context$='checkbox'])::before {
|
|
29
|
-
box-shadow:
|
|
30
|
-
0 0 0 2px var(--lumo-base-color),
|
|
31
|
-
0 0 0 4px var(--_active-user-color);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([context$='radio-button'])::before {
|
|
35
|
-
border-radius: 50%;
|
|
36
|
-
box-shadow:
|
|
37
|
-
0 0 0 3px var(--lumo-base-color),
|
|
38
|
-
0 0 0 5px var(--_active-user-color);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:host([context$='item'])::before {
|
|
42
|
-
box-shadow: inset 0 0 0 2px var(--_active-user-color);
|
|
43
|
-
}
|
|
44
|
-
`,
|
|
45
|
-
{ moduleId: 'lumo-field-outline' },
|
|
46
|
-
);
|
|
@@ -1,9 +0,0 @@
|
|
|
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 '@vaadin/vaadin-lumo-styles/color.js';
|
|
7
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
8
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
9
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
@@ -1,68 +0,0 @@
|
|
|
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 '@vaadin/vaadin-lumo-styles/color.js';
|
|
7
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
8
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
9
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
10
|
-
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
11
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
|
|
13
|
-
registerStyles(
|
|
14
|
-
'vaadin-user-tags-overlay',
|
|
15
|
-
[
|
|
16
|
-
overlay,
|
|
17
|
-
css`
|
|
18
|
-
[part='overlay'] {
|
|
19
|
-
will-change: opacity, transform;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
:host([opening]) [part='overlay'] {
|
|
23
|
-
animation: 0.1s lumo-user-tags-enter ease-out both;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@keyframes lumo-user-tags-enter {
|
|
27
|
-
0% {
|
|
28
|
-
opacity: 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host([closing]) [part='overlay'] {
|
|
33
|
-
animation: 0.1s lumo-user-tags-exit both;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@keyframes lumo-user-tags-exit {
|
|
37
|
-
100% {
|
|
38
|
-
opacity: 0;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`,
|
|
42
|
-
],
|
|
43
|
-
{
|
|
44
|
-
moduleId: 'lumo-user-tags-overlay',
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
registerStyles(
|
|
49
|
-
'vaadin-user-tag',
|
|
50
|
-
css`
|
|
51
|
-
:host {
|
|
52
|
-
font-family: var(--lumo-font-family);
|
|
53
|
-
font-size: var(--lumo-font-size-xxs);
|
|
54
|
-
border-radius: var(--lumo-border-radius-s);
|
|
55
|
-
box-shadow: var(--lumo-box-shadow-xs);
|
|
56
|
-
--vaadin-user-tag-offset: var(--lumo-space-xs);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[part='name'] {
|
|
60
|
-
color: var(--lumo-primary-contrast-color);
|
|
61
|
-
padding: 0.3em calc(0.3em + var(--lumo-border-radius-s) / 4);
|
|
62
|
-
line-height: 1;
|
|
63
|
-
font-weight: 500;
|
|
64
|
-
min-width: calc(var(--lumo-line-height-xs) * 1em + 0.45em);
|
|
65
|
-
}
|
|
66
|
-
`,
|
|
67
|
-
{ moduleId: 'lumo-user-tag' },
|
|
68
|
-
);
|