@vaadin/notification 24.8.0-alpha9 → 25.0.0-alpha2

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/README.md CHANGED
@@ -34,29 +34,6 @@ Once installed, import the component in your application:
34
34
  import '@vaadin/notification';
35
35
  ```
36
36
 
37
- ## Themes
38
-
39
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
40
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/notification/vaadin-notification.js) of the package uses the Lumo theme.
41
-
42
- To use the Material theme, import the component from the `theme/material` folder:
43
-
44
- ```js
45
- import '@vaadin/notification/theme/material/vaadin-notification.js';
46
- ```
47
-
48
- You can also import the Lumo version of the component explicitly:
49
-
50
- ```js
51
- import '@vaadin/notification/theme/lumo/vaadin-notification.js';
52
- ```
53
-
54
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
55
-
56
- ```js
57
- import '@vaadin/notification/src/vaadin-notification.js';
58
- ```
59
-
60
37
  ## Contributing
61
38
 
62
39
  Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/notification",
3
- "version": "24.8.0-alpha9",
3
+ "version": "25.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,30 +33,27 @@
33
33
  "Vaadin",
34
34
  "vaadin-notification",
35
35
  "web-components",
36
- "web-component",
37
- "polymer"
36
+ "web-component"
38
37
  ],
39
38
  "dependencies": {
40
39
  "@open-wc/dedupe-mixin": "^1.3.0",
41
- "@polymer/polymer": "^3.0.0",
42
- "@vaadin/component-base": "24.8.0-alpha9",
43
- "@vaadin/lit-renderer": "24.8.0-alpha9",
44
- "@vaadin/overlay": "24.8.0-alpha9",
45
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha9",
46
- "@vaadin/vaadin-material-styles": "24.8.0-alpha9",
47
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha9",
40
+ "@vaadin/component-base": "25.0.0-alpha2",
41
+ "@vaadin/lit-renderer": "25.0.0-alpha2",
42
+ "@vaadin/overlay": "25.0.0-alpha2",
43
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
44
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
48
45
  "lit": "^3.0.0"
49
46
  },
50
47
  "devDependencies": {
51
- "@vaadin/button": "24.8.0-alpha9",
52
- "@vaadin/chai-plugins": "24.8.0-alpha9",
53
- "@vaadin/test-runner-commands": "24.8.0-alpha9",
54
- "@vaadin/testing-helpers": "^1.1.0",
48
+ "@vaadin/button": "25.0.0-alpha2",
49
+ "@vaadin/chai-plugins": "25.0.0-alpha2",
50
+ "@vaadin/test-runner-commands": "25.0.0-alpha2",
51
+ "@vaadin/testing-helpers": "^2.0.0",
55
52
  "sinon": "^18.0.0"
56
53
  },
57
54
  "web-types": [
58
55
  "web-types.json",
59
56
  "web-types.lit.json"
60
57
  ],
61
- "gitHead": "4de3809275ddfd733b0d13fd02af8faf73eb6770"
58
+ "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
62
59
  }
@@ -7,7 +7,6 @@ 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 { processTemplates } from '@vaadin/component-base/src/templates.js';
11
10
  import { OverlayStackMixin } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
12
11
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
13
12
 
@@ -246,8 +245,6 @@ export const NotificationMixin = (superClass) =>
246
245
  super.ready();
247
246
 
248
247
  this._overlayElement = this.shadowRoot.querySelector('vaadin-notification-card');
249
-
250
- processTemplates(this);
251
248
  }
252
249
 
253
250
  /** @protected */
@@ -3,21 +3,15 @@
3
3
  * Copyright (c) 2017 - 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 { css, html, LitElement } from 'lit';
7
+ import { ifDefined } from 'lit/directives/if-defined.js';
7
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
12
  import { NotificationContainerMixin, NotificationMixin } from './vaadin-notification-mixin.js';
11
13
  import { notificationCardStyles, notificationContainerStyles } from './vaadin-notification-styles.js';
12
14
 
13
- registerStyles('vaadin-notification-container', notificationContainerStyles, {
14
- moduleId: 'vaadin-notification-container-styles',
15
- });
16
-
17
- registerStyles('vaadin-notification-card', notificationCardStyles, {
18
- moduleId: 'vaadin-notification-card-styles',
19
- });
20
-
21
15
  /**
22
16
  * An element used internally by `<vaadin-notification>`. Not intended to be used separately.
23
17
  *
@@ -28,8 +22,17 @@ registerStyles('vaadin-notification-card', notificationCardStyles, {
28
22
  * @mixes ThemableMixin
29
23
  * @private
30
24
  */
31
- class NotificationContainer extends NotificationContainerMixin(ThemableMixin(ElementMixin(PolymerElement))) {
32
- static get template() {
25
+ class NotificationContainer extends NotificationContainerMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
26
+ static get is() {
27
+ return 'vaadin-notification-container';
28
+ }
29
+
30
+ static get styles() {
31
+ return notificationContainerStyles;
32
+ }
33
+
34
+ /** @protected */
35
+ render() {
33
36
  return html`
34
37
  <div region="top-stretch"><slot name="top-stretch"></slot></div>
35
38
  <div region-group="top">
@@ -46,10 +49,6 @@ class NotificationContainer extends NotificationContainerMixin(ThemableMixin(Ele
46
49
  <div region="bottom-stretch"><slot name="bottom-stretch"></slot></div>
47
50
  `;
48
51
  }
49
-
50
- static get is() {
51
- return 'vaadin-notification-container';
52
- }
53
52
  }
54
53
 
55
54
  /**
@@ -60,8 +59,17 @@ class NotificationContainer extends NotificationContainerMixin(ThemableMixin(Ele
60
59
  * @mixes ThemableMixin
61
60
  * @private
62
61
  */
63
- class NotificationCard extends ThemableMixin(PolymerElement) {
64
- static get template() {
62
+ class NotificationCard extends ThemableMixin(PolylitMixin(LitElement)) {
63
+ static get is() {
64
+ return 'vaadin-notification-card';
65
+ }
66
+
67
+ static get styles() {
68
+ return notificationCardStyles;
69
+ }
70
+
71
+ /** @protected */
72
+ render() {
65
73
  return html`
66
74
  <div part="overlay">
67
75
  <div part="content">
@@ -71,10 +79,6 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
71
79
  `;
72
80
  }
73
81
 
74
- static get is() {
75
- return 'vaadin-notification-card';
76
- }
77
-
78
82
  /** @protected */
79
83
  ready() {
80
84
  super.ready();
@@ -134,24 +138,34 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
134
138
  * @mixes NotificationMixin
135
139
  * @mixes ElementMixin
136
140
  */
137
- class Notification extends NotificationMixin(ElementMixin(PolymerElement)) {
138
- static get template() {
141
+ class Notification extends NotificationMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
142
+ static get is() {
143
+ return 'vaadin-notification';
144
+ }
145
+
146
+ static get styles() {
147
+ return css`
148
+ :host {
149
+ display: none !important;
150
+ }
151
+ `;
152
+ }
153
+
154
+ /** @protected */
155
+ render() {
139
156
  return html`
140
- <style>
141
- :host {
142
- display: none !important;
143
- }
144
- </style>
145
157
  <vaadin-notification-card
146
- theme$="[[_theme]]"
147
- aria-live$="[[__computeAriaLive(assertive)]]"
158
+ theme="${ifDefined(this._theme)}"
159
+ aria-live="${this.__computeAriaLive(this.assertive)}"
148
160
  ></vaadin-notification-card>
149
161
  `;
150
162
  }
151
163
 
152
- static get is() {
153
- return 'vaadin-notification';
154
- }
164
+ /**
165
+ * Fired when the notification is closed.
166
+ *
167
+ * @event closed
168
+ */
155
169
  }
156
170
 
157
171
  defineCustomElement(NotificationContainer);
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": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha2",
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": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,133 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css, html, LitElement } from 'lit';
7
- import { ifDefined } from 'lit/directives/if-defined.js';
8
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import { NotificationContainerMixin, NotificationMixin } from './vaadin-notification-mixin.js';
13
- import { notificationCardStyles, notificationContainerStyles } from './vaadin-notification-styles.js';
14
-
15
- /**
16
- * An element used internally by `<vaadin-notification>`. Not intended to be used separately.
17
- *
18
- * @customElement
19
- * @extends HTMLElement
20
- * @mixes NotificationContainerMixin
21
- * @mixes ElementMixin
22
- * @mixes ThemableMixin
23
- * @private
24
- */
25
- class NotificationContainer extends NotificationContainerMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
26
- static get styles() {
27
- return notificationContainerStyles;
28
- }
29
-
30
- /** @protected */
31
- render() {
32
- return html`
33
- <div region="top-stretch"><slot name="top-stretch"></slot></div>
34
- <div region-group="top">
35
- <div region="top-start"><slot name="top-start"></slot></div>
36
- <div region="top-center"><slot name="top-center"></slot></div>
37
- <div region="top-end"><slot name="top-end"></slot></div>
38
- </div>
39
- <div region="middle"><slot name="middle"></slot></div>
40
- <div region-group="bottom">
41
- <div region="bottom-start"><slot name="bottom-start"></slot></div>
42
- <div region="bottom-center"><slot name="bottom-center"></slot></div>
43
- <div region="bottom-end"><slot name="bottom-end"></slot></div>
44
- </div>
45
- <div region="bottom-stretch"><slot name="bottom-stretch"></slot></div>
46
- `;
47
- }
48
-
49
- static get is() {
50
- return 'vaadin-notification-container';
51
- }
52
- }
53
-
54
- /**
55
- * An element used internally by `<vaadin-notification>`. Not intended to be used separately.
56
- *
57
- * @customElement
58
- * @extends HTMLElement
59
- * @mixes ThemableMixin
60
- * @mixes ElementMixin
61
- * @private
62
- */
63
- class NotificationCard extends ElementMixin(ThemableMixin(PolylitMixin(LitElement))) {
64
- static get styles() {
65
- return notificationCardStyles;
66
- }
67
-
68
- /** @protected */
69
- render() {
70
- return html`
71
- <div part="overlay">
72
- <div part="content">
73
- <slot></slot>
74
- </div>
75
- </div>
76
- `;
77
- }
78
-
79
- static get is() {
80
- return 'vaadin-notification-card';
81
- }
82
-
83
- /** @protected */
84
- ready() {
85
- super.ready();
86
- this.setAttribute('role', 'alert');
87
- }
88
- }
89
-
90
- /**
91
- * LitElement based version of `<vaadin-notification>` web component.
92
- *
93
- * ## Disclaimer
94
- *
95
- * This component is an experiment and not yet a part of Vaadin platform.
96
- * There is no ETA regarding specific Vaadin version where it'll land.
97
- * Feel free to try this code in your apps as per Apache 2.0 license.
98
- */
99
- class Notification extends NotificationMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
100
- static get styles() {
101
- return css`
102
- :host {
103
- display: none !important;
104
- }
105
- `;
106
- }
107
-
108
- /** @protected */
109
- render() {
110
- return html`
111
- <vaadin-notification-card
112
- theme="${ifDefined(this._theme)}"
113
- aria-live="${this.__computeAriaLive(this.assertive)}"
114
- ></vaadin-notification-card>
115
- `;
116
- }
117
-
118
- static get is() {
119
- return 'vaadin-notification';
120
- }
121
-
122
- /**
123
- * Fired when the notification is closed.
124
- *
125
- * @event closed
126
- */
127
- }
128
-
129
- defineCustomElement(NotificationContainer);
130
- defineCustomElement(NotificationCard);
131
- defineCustomElement(Notification);
132
-
133
- export { Notification };
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-lit-notification.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-lit-notification.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-lit-notification.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-lit-notification.js';
@@ -1,2 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/typography.js';
2
- import '@vaadin/vaadin-material-styles/shadow.js';
@@ -1,149 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/typography.js';
2
- import '@vaadin/vaadin-material-styles/shadow.js';
3
- import { colorDark } from '@vaadin/vaadin-material-styles/color.js';
4
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
-
6
- registerStyles(
7
- 'vaadin-notification-container',
8
- css`
9
- :host {
10
- inset: 0 4px;
11
- }
12
-
13
- @media (min-width: 420px) {
14
- :host {
15
- inset: 0 12px;
16
- }
17
- }
18
- `,
19
- { moduleId: 'material-notification-container' },
20
- );
21
-
22
- const notificationCard = css`
23
- :host {
24
- min-height: 48px;
25
- margin: 8px 4px;
26
- background-color: transparent;
27
- }
28
-
29
- [part='overlay'] {
30
- background-color: var(--material-background-color);
31
- border-radius: 4px;
32
- box-shadow: var(--material-shadow-elevation-6dp);
33
- padding: 14px 16px;
34
- justify-content: stretch;
35
- }
36
-
37
- [part='content'] {
38
- font-family: var(--material-font-family);
39
- font-size: var(--material-small-font-size);
40
- font-weight: 400;
41
- line-height: 20px;
42
- letter-spacing: 0;
43
- text-transform: none;
44
- box-sizing: border-box;
45
- display: flex;
46
- justify-content: space-between;
47
- align-items: center;
48
- }
49
-
50
- /* NOTE(platosha): Makes the button take exactly 1 line of vertical space */
51
- [part='content'] ::slotted(vaadin-button) {
52
- margin: -8px 0;
53
- }
54
-
55
- :host([slot$='stretch']) {
56
- margin: 0 -4px;
57
- }
58
-
59
- :host([slot$='stretch']) [part='overlay'] {
60
- border-radius: 0;
61
- }
62
-
63
- @media (min-width: 420px) {
64
- :host {
65
- margin: 24px 12px;
66
- }
67
-
68
- :host([slot^='middle']) {
69
- width: 372px;
70
- margin: auto;
71
- }
72
-
73
- :host([slot$='stretch']) {
74
- margin: 0 -12px;
75
- }
76
- }
77
-
78
- @keyframes material-notification-exit-fade-out {
79
- 100% {
80
- opacity: 0;
81
- }
82
- }
83
-
84
- @keyframes material-notification-enter-fade-in {
85
- 0% {
86
- opacity: 0;
87
- }
88
-
89
- 100% {
90
- opacity: 1;
91
- }
92
- }
93
-
94
- @keyframes material-notification-enter-slide-down {
95
- 0% {
96
- transform: translateY(-200%);
97
- opacity: 0;
98
- }
99
- }
100
-
101
- @keyframes material-notification-exit-slide-up {
102
- 100% {
103
- transform: translateY(-200%);
104
- opacity: 0;
105
- }
106
- }
107
-
108
- @keyframes material-notification-enter-slide-up {
109
- 0% {
110
- transform: translateY(200%);
111
- opacity: 0;
112
- }
113
- }
114
-
115
- @keyframes material-notification-exit-slide-down {
116
- 100% {
117
- transform: translateY(200%);
118
- opacity: 0;
119
- }
120
- }
121
-
122
- :host([slot='middle'][opening]) {
123
- animation: material-notification-enter-fade-in 300ms;
124
- }
125
-
126
- :host([slot='middle'][closing]) {
127
- animation: material-notification-exit-fade-out 300ms;
128
- }
129
-
130
- :host([slot^='top'][opening]) {
131
- animation: material-notification-enter-slide-down 300ms;
132
- }
133
-
134
- :host([slot^='top'][closing]) {
135
- animation: material-notification-exit-slide-up 300ms;
136
- }
137
-
138
- :host([slot^='bottom'][opening]) {
139
- animation: material-notification-enter-slide-up 300ms;
140
- }
141
-
142
- :host([slot^='bottom'][closing]) {
143
- animation: material-notification-exit-slide-down 300ms;
144
- }
145
- `;
146
-
147
- registerStyles('vaadin-notification-card', [colorDark, notificationCard], {
148
- moduleId: 'material-notification-card',
149
- });
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-notification.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-notification-styles.js';
2
- import '../../src/vaadin-notification.js';
@@ -1 +0,0 @@
1
- export * from './vaadin-notification.js';
@@ -1,2 +0,0 @@
1
- import './theme/lumo/vaadin-lit-notification.js';
2
- export * from './src/vaadin-lit-notification.js';