@vaadin/notification 25.3.0-alpha7 → 25.3.0-alpha9
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/custom-elements.json +32 -25
- package/package.json +11 -10
- package/src/styles/vaadin-notification-card-base-styles.d.ts +1 -1
- package/src/styles/vaadin-notification-card-base-styles.js +111 -1
- package/src/vaadin-notification-mixin.js +24 -7
- package/src/vaadin-notification.js +3 -0
- package/web-types.json +2 -4
- package/web-types.lit.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -418,30 +418,6 @@
|
|
|
418
418
|
"name": "opened-changed"
|
|
419
419
|
}
|
|
420
420
|
],
|
|
421
|
-
"mixins": [
|
|
422
|
-
{
|
|
423
|
-
"name": "NotificationMixin",
|
|
424
|
-
"module": "src/vaadin-notification-mixin.js"
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"name": "ElementMixin",
|
|
428
|
-
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
"name": "ThemableMixin",
|
|
432
|
-
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
"name": "PolylitMixin",
|
|
436
|
-
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
"superclass": {
|
|
440
|
-
"name": "LitElement",
|
|
441
|
-
"package": "lit"
|
|
442
|
-
},
|
|
443
|
-
"tagName": "vaadin-notification",
|
|
444
|
-
"customElement": true,
|
|
445
421
|
"attributes": [
|
|
446
422
|
{
|
|
447
423
|
"name": "assertive",
|
|
@@ -514,8 +490,39 @@
|
|
|
514
490
|
"name": "NotificationMixin",
|
|
515
491
|
"module": "src/vaadin-notification-mixin.js"
|
|
516
492
|
}
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"type": {
|
|
496
|
+
"text": "string"
|
|
497
|
+
},
|
|
498
|
+
"description": "The theme variants to apply to the component.",
|
|
499
|
+
"name": "theme"
|
|
517
500
|
}
|
|
518
|
-
]
|
|
501
|
+
],
|
|
502
|
+
"mixins": [
|
|
503
|
+
{
|
|
504
|
+
"name": "NotificationMixin",
|
|
505
|
+
"module": "src/vaadin-notification-mixin.js"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "ElementMixin",
|
|
509
|
+
"package": "@vaadin/component-base/src/element-mixin.js"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"name": "ThemableMixin",
|
|
513
|
+
"package": "@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"name": "PolylitMixin",
|
|
517
|
+
"package": "@vaadin/component-base/src/polylit-mixin.js"
|
|
518
|
+
}
|
|
519
|
+
],
|
|
520
|
+
"superclass": {
|
|
521
|
+
"name": "LitElement",
|
|
522
|
+
"package": "lit"
|
|
523
|
+
},
|
|
524
|
+
"tagName": "vaadin-notification",
|
|
525
|
+
"customElement": true
|
|
519
526
|
}
|
|
520
527
|
],
|
|
521
528
|
"exports": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/notification",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,18 +37,19 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/component-base": "25.3.0-
|
|
41
|
-
"@vaadin/lit-renderer": "25.3.0-
|
|
42
|
-
"@vaadin/
|
|
40
|
+
"@vaadin/component-base": "25.3.0-alpha9",
|
|
41
|
+
"@vaadin/lit-renderer": "25.3.0-alpha9",
|
|
42
|
+
"@vaadin/overlay": "25.3.0-alpha9",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.3.0-alpha9",
|
|
43
44
|
"lit": "^3.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@vaadin/aura": "25.3.0-
|
|
47
|
-
"@vaadin/button": "25.3.0-
|
|
48
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
49
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
47
|
+
"@vaadin/aura": "25.3.0-alpha9",
|
|
48
|
+
"@vaadin/button": "25.3.0-alpha9",
|
|
49
|
+
"@vaadin/chai-plugins": "25.3.0-alpha9",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha9",
|
|
50
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "25.3.0-
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.3.0-alpha9",
|
|
52
53
|
"sinon": "^22.0.0"
|
|
53
54
|
},
|
|
54
55
|
"customElements": "custom-elements.json",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"web-types.json",
|
|
57
58
|
"web-types.lit.json"
|
|
58
59
|
],
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "cb915ebde095ec5b94a87af93dd4530f51984c52"
|
|
60
61
|
}
|
|
@@ -5,10 +5,57 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
7
|
import { css } from 'lit';
|
|
8
|
+
import { overlayAnimationStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-animation-base-styles.js';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const notificationCard = css`
|
|
10
11
|
:host {
|
|
11
12
|
display: block;
|
|
13
|
+
position: relative;
|
|
14
|
+
--vaadin-overlay-animation-duration: 0.3s;
|
|
15
|
+
transition-duration: var(--vaadin-overlay-animation-duration);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([closing]) [part='overlay'] {
|
|
19
|
+
animation-fill-mode: both;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([slot^='top']) {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: end;
|
|
25
|
+
--vaadin-overlay-translate-closed: 0% -30%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([slot^='bottom']) {
|
|
29
|
+
--vaadin-overlay-translate-closed: 0% 30%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Cards on the sides slide in horizontally, once the vertical collapse is done */
|
|
33
|
+
@media (min-width: 600px) and (min-height: 600px) {
|
|
34
|
+
:host([slot$='start']) {
|
|
35
|
+
--vaadin-overlay-translate-closed: -30% 0%;
|
|
36
|
+
--vaadin-overlay-animation-delay: var(--vaadin-overlay-animation-duration);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([slot$='end']) {
|
|
40
|
+
--vaadin-overlay-translate-closed: 30% 0%;
|
|
41
|
+
--vaadin-overlay-animation-delay: var(--vaadin-overlay-animation-duration);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([closing]) {
|
|
46
|
+
animation-direction: reverse;
|
|
47
|
+
animation-duration: var(--vaadin-overlay-animation-duration);
|
|
48
|
+
animation-delay: var(--vaadin-overlay-animation-duration);
|
|
49
|
+
transition-delay: var(--vaadin-overlay-animation-duration);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Cards scale down in place instead of sliding back out */
|
|
53
|
+
/* WebKit/Safari needs these to be explicitly set on the part=overlay element as well */
|
|
54
|
+
:host([closing]),
|
|
55
|
+
:host([closing]) [part='overlay'] {
|
|
56
|
+
--vaadin-overlay-translate-closed: 0%;
|
|
57
|
+
--vaadin-overlay-scale-closed: 0.98;
|
|
58
|
+
--vaadin-overlay-animation-delay: 0s;
|
|
12
59
|
}
|
|
13
60
|
|
|
14
61
|
[part='overlay'] {
|
|
@@ -30,4 +77,67 @@ export const notificationCardStyles = css`
|
|
|
30
77
|
border: 3px solid !important;
|
|
31
78
|
}
|
|
32
79
|
}
|
|
80
|
+
|
|
81
|
+
/* The other cards make room for a card that opens, and close the gap when it is removed */
|
|
82
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
83
|
+
@supports (interpolate-size: allow-keywords) {
|
|
84
|
+
:host {
|
|
85
|
+
interpolate-size: allow-keywords;
|
|
86
|
+
transition-property: height, margin-top, margin-bottom;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@starting-style {
|
|
90
|
+
:host([opening]:not(:nth-child(1 of [slot='middle']))),
|
|
91
|
+
:host([closing]) {
|
|
92
|
+
height: 0;
|
|
93
|
+
margin-top: 0 !important;
|
|
94
|
+
margin-bottom: 0 !important;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host([closing]) {
|
|
99
|
+
height: 0;
|
|
100
|
+
margin-top: 0 !important;
|
|
101
|
+
margin-bottom: 0 !important;
|
|
102
|
+
transition-delay: var(--vaadin-overlay-animation-duration);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Without interpolate-size, only the margins animate, and max-height stands in for the height */
|
|
107
|
+
@supports not (interpolate-size: allow-keywords) {
|
|
108
|
+
:host([opening]:not(:nth-child(1 of [slot='middle']))),
|
|
109
|
+
:host([closing]) {
|
|
110
|
+
animation-name: --notification-max-height, --notification-margins;
|
|
111
|
+
animation-duration: calc(var(--vaadin-overlay-animation-duration) * 2 + var(--vaadin-overlay-animation-delay));
|
|
112
|
+
animation-delay: 0s;
|
|
113
|
+
animation-timing-function: ease-in-out, cubic-bezier(0.4, 1.1, 0, 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (prefers-reduced-motion) {
|
|
119
|
+
/* The height animation of the fallback above is a keyframe animation, not a transition */
|
|
120
|
+
:host(:is([opening], [closing])) {
|
|
121
|
+
animation-name: --fade !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@keyframes --notification-max-height {
|
|
126
|
+
0% {
|
|
127
|
+
max-height: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
50% {
|
|
131
|
+
max-height: 20em;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes --notification-margins {
|
|
136
|
+
0% {
|
|
137
|
+
margin-top: 0;
|
|
138
|
+
margin-bottom: 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
33
141
|
`;
|
|
142
|
+
|
|
143
|
+
export const notificationCardStyles = [overlayAnimationStyles, notificationCard];
|
|
@@ -7,6 +7,7 @@ import { render } from 'lit';
|
|
|
7
7
|
import { isTemplateResult } from 'lit/directive-helpers.js';
|
|
8
8
|
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
9
9
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
10
|
+
import { shouldAnimate } from '@vaadin/overlay/src/vaadin-overlay-utils.js';
|
|
10
11
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -342,6 +343,21 @@ export const NotificationMixin = (superClass) =>
|
|
|
342
343
|
this._card.removeEventListener('animationend', this.__animationEndListener);
|
|
343
344
|
}
|
|
344
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Run the callback when the animation of the card itself ends. Animations of the
|
|
348
|
+
* notification content also end on the card, as the content is in its light DOM.
|
|
349
|
+
* @private
|
|
350
|
+
*/
|
|
351
|
+
__onCardAnimationEnd(callback) {
|
|
352
|
+
this.__animationEndListener = (event) => {
|
|
353
|
+
if (event.target !== this._card) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
callback();
|
|
357
|
+
};
|
|
358
|
+
this._card.addEventListener('animationend', this.__animationEndListener);
|
|
359
|
+
}
|
|
360
|
+
|
|
345
361
|
/** @private */
|
|
346
362
|
_animatedAppendNotificationCard() {
|
|
347
363
|
if (this._card) {
|
|
@@ -349,8 +365,11 @@ export const NotificationMixin = (superClass) =>
|
|
|
349
365
|
|
|
350
366
|
this._card.setAttribute('opening', '');
|
|
351
367
|
this._appendNotificationCard();
|
|
352
|
-
|
|
353
|
-
|
|
368
|
+
if (shouldAnimate(this._card)) {
|
|
369
|
+
this.__onCardAnimationEnd(() => this.__cleanUpOpeningClosingState());
|
|
370
|
+
} else {
|
|
371
|
+
this.__cleanUpOpeningClosingState();
|
|
372
|
+
}
|
|
354
373
|
this._didAnimateNotificationAppend = true;
|
|
355
374
|
} else {
|
|
356
375
|
this._didAnimateNotificationAppend = false;
|
|
@@ -409,13 +428,11 @@ export const NotificationMixin = (superClass) =>
|
|
|
409
428
|
this.__cleanUpOpeningClosingState();
|
|
410
429
|
|
|
411
430
|
this._card.setAttribute('closing', '');
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
this.__animationEndListener = () => {
|
|
431
|
+
if (shouldAnimate(this._card)) {
|
|
432
|
+
this.__onCardAnimationEnd(() => {
|
|
415
433
|
this._removeNotificationCard();
|
|
416
434
|
this.__cleanUpOpeningClosingState();
|
|
417
|
-
};
|
|
418
|
-
this._card.addEventListener('animationend', this.__animationEndListener);
|
|
435
|
+
});
|
|
419
436
|
} else {
|
|
420
437
|
this._removeNotificationCard();
|
|
421
438
|
}
|
|
@@ -17,6 +17,7 @@ import { NotificationContainerMixin, NotificationMixin } from './vaadin-notifica
|
|
|
17
17
|
/**
|
|
18
18
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
19
19
|
*
|
|
20
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
20
21
|
* @customElement vaadin-notification-container
|
|
21
22
|
* @extends HTMLElement
|
|
22
23
|
* @private
|
|
@@ -55,6 +56,7 @@ class NotificationContainer extends NotificationContainerMixin(
|
|
|
55
56
|
/**
|
|
56
57
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
57
58
|
*
|
|
59
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
58
60
|
* @customElement vaadin-notification-card
|
|
59
61
|
* @extends HTMLElement
|
|
60
62
|
* @private
|
|
@@ -147,6 +149,7 @@ class NotificationCard extends ThemableMixin(PolylitMixin(LumoInjectionMixin(Lit
|
|
|
147
149
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
148
150
|
* @fires {CustomEvent} closed - Fired when the notification is closed.
|
|
149
151
|
*
|
|
152
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
150
153
|
* @customElement vaadin-notification
|
|
151
154
|
* @extends HTMLElement
|
|
152
155
|
*/
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/notification",
|
|
4
|
-
"version": "25.3.0-
|
|
4
|
+
"version": "25.3.0-alpha9",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -60,9 +60,7 @@
|
|
|
60
60
|
"description": "The theme variants to apply to the component.",
|
|
61
61
|
"value": {
|
|
62
62
|
"type": [
|
|
63
|
-
"string"
|
|
64
|
-
"null",
|
|
65
|
-
"undefined"
|
|
63
|
+
"string"
|
|
66
64
|
]
|
|
67
65
|
}
|
|
68
66
|
}
|
package/web-types.lit.json
CHANGED