@vaadin/notification 25.3.0-alpha8 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/notification",
3
- "version": "25.3.0-alpha8",
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-alpha8",
41
- "@vaadin/lit-renderer": "25.3.0-alpha8",
42
- "@vaadin/vaadin-themable-mixin": "25.3.0-alpha8",
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-alpha8",
47
- "@vaadin/button": "25.3.0-alpha8",
48
- "@vaadin/chai-plugins": "25.3.0-alpha8",
49
- "@vaadin/test-runner-commands": "25.3.0-alpha8",
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-alpha8",
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": "ccbb4aaffb63c745c6da0426b532d4d05e47af29"
60
+ "gitHead": "cb915ebde095ec5b94a87af93dd4530f51984c52"
60
61
  }
@@ -5,4 +5,4 @@
5
5
  */
6
6
  import type { CSSResult } from 'lit';
7
7
 
8
- export const notificationCardStyles: CSSResult;
8
+ export const notificationCardStyles: CSSResult[];
@@ -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
- export const notificationCardStyles = css`
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
- this.__animationEndListener = () => this.__cleanUpOpeningClosingState();
353
- this._card.addEventListener('animationend', this.__animationEndListener);
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
- const name = getComputedStyle(this._card).getPropertyValue('animation-name');
413
- if (name && name !== 'none') {
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
  }
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-alpha8",
4
+ "version": "25.3.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -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-alpha8",
4
+ "version": "25.3.0-alpha9",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {