@vaadin/notification 24.8.4 → 25.0.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.
- package/README.md +0 -23
- package/package.json +11 -15
- package/src/styles/vaadin-notification-card-core-styles.d.ts +8 -0
- package/src/styles/vaadin-notification-card-core-styles.js +22 -0
- package/src/styles/vaadin-notification-container-core-styles.d.ts +8 -0
- package/src/{vaadin-notification-styles.js → styles/vaadin-notification-container-core-styles.js} +8 -17
- package/src/vaadin-notification-mixin.d.ts +6 -2
- package/src/vaadin-notification-mixin.js +25 -7
- package/src/vaadin-notification.js +53 -35
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
- package/src/vaadin-lit-notification.js +0 -133
- package/theme/lumo/vaadin-lit-notification.d.ts +0 -2
- package/theme/lumo/vaadin-lit-notification.js +0 -2
- package/theme/material/vaadin-lit-notification.d.ts +0 -2
- package/theme/material/vaadin-lit-notification.js +0 -2
- package/theme/material/vaadin-notification-styles.d.ts +0 -2
- package/theme/material/vaadin-notification-styles.js +0 -149
- package/theme/material/vaadin-notification.d.ts +0 -2
- package/theme/material/vaadin-notification.js +0 -2
- package/vaadin-lit-notification.d.ts +0 -1
- package/vaadin-lit-notification.js +0 -2
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": "
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,30 +33,26 @@
|
|
|
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
|
-
"@
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "~24.8.4",
|
|
46
|
-
"@vaadin/vaadin-material-styles": "~24.8.4",
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "~24.8.4",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/lit-renderer": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
48
44
|
"lit": "^3.0.0"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
|
-
"@vaadin/button": "
|
|
52
|
-
"@vaadin/chai-plugins": "
|
|
53
|
-
"@vaadin/test-runner-commands": "
|
|
54
|
-
"@vaadin/testing-helpers": "^
|
|
47
|
+
"@vaadin/button": "25.0.0-alpha10",
|
|
48
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
49
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
50
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
55
51
|
"sinon": "^18.0.0"
|
|
56
52
|
},
|
|
57
53
|
"web-types": [
|
|
58
54
|
"web-types.json",
|
|
59
55
|
"web-types.lit.json"
|
|
60
56
|
],
|
|
61
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
62
58
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 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
|
+
|
|
8
|
+
export const notificationCardStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[part='overlay'] {
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@media (forced-colors: active) {
|
|
18
|
+
[part='overlay'] {
|
|
19
|
+
outline: 3px solid;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
package/src/{vaadin-notification-styles.js → styles/vaadin-notification-container-core-styles.js}
RENAMED
|
@@ -8,13 +8,20 @@ import { css } from 'lit';
|
|
|
8
8
|
export const notificationContainerStyles = css`
|
|
9
9
|
:host {
|
|
10
10
|
position: fixed;
|
|
11
|
-
z-index: 1000;
|
|
12
11
|
inset: 0;
|
|
13
12
|
box-sizing: border-box;
|
|
14
13
|
display: flex;
|
|
15
14
|
flex-direction: column;
|
|
16
15
|
align-items: stretch;
|
|
17
16
|
pointer-events: none;
|
|
17
|
+
|
|
18
|
+
/* Override native [popover] user agent styles */
|
|
19
|
+
width: auto;
|
|
20
|
+
height: auto;
|
|
21
|
+
border: none;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
overflow: visible;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
[region-group] {
|
|
@@ -53,19 +60,3 @@ export const notificationContainerStyles = css`
|
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
`;
|
|
56
|
-
|
|
57
|
-
export const notificationCardStyles = css`
|
|
58
|
-
:host {
|
|
59
|
-
display: block;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
[part='overlay'] {
|
|
63
|
-
pointer-events: auto;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@media (forced-colors: active) {
|
|
67
|
-
[part='overlay'] {
|
|
68
|
-
outline: 3px solid;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
1
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
2
7
|
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
3
|
-
import type { OverlayStackMixinClass } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
|
|
4
8
|
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
5
9
|
import type { Notification } from './vaadin-notification.js';
|
|
6
10
|
|
|
@@ -22,7 +26,7 @@ export type NotificationRenderer = (root: HTMLElement, notification: Notificatio
|
|
|
22
26
|
*/
|
|
23
27
|
export declare function NotificationContainerMixin<T extends Constructor<HTMLElement>>(
|
|
24
28
|
base: T,
|
|
25
|
-
): Constructor<NotificationContainerMixinClass> &
|
|
29
|
+
): Constructor<NotificationContainerMixinClass> & T;
|
|
26
30
|
|
|
27
31
|
export declare class NotificationContainerMixinClass {
|
|
28
32
|
/**
|
|
@@ -7,18 +7,15 @@ 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
|
-
import { OverlayStackMixin } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
|
|
12
10
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* A mixin providing common notification container functionality.
|
|
16
14
|
*
|
|
17
15
|
* @polymerMixin
|
|
18
|
-
* @mixes OverlayStackMixin
|
|
19
16
|
*/
|
|
20
17
|
export const NotificationContainerMixin = (superClass) =>
|
|
21
|
-
class extends
|
|
18
|
+
class extends superClass {
|
|
22
19
|
static get properties() {
|
|
23
20
|
return {
|
|
24
21
|
/**
|
|
@@ -43,10 +40,28 @@ export const NotificationContainerMixin = (superClass) =>
|
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
|
|
43
|
+
/** @protected */
|
|
44
|
+
firstUpdated(props) {
|
|
45
|
+
super.firstUpdated(props);
|
|
46
|
+
|
|
47
|
+
this.popover = 'manual';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Move the notification container to the top of the stack.
|
|
52
|
+
*/
|
|
53
|
+
bringToFront() {
|
|
54
|
+
if (this.matches(':popover-open')) {
|
|
55
|
+
this.hidePopover();
|
|
56
|
+
this.showPopover();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
/** @private */
|
|
47
61
|
_openedChanged(opened) {
|
|
48
62
|
if (opened) {
|
|
49
63
|
document.body.appendChild(this);
|
|
64
|
+
this.showPopover();
|
|
50
65
|
document.addEventListener('vaadin-overlay-close', this._boundVaadinOverlayClose);
|
|
51
66
|
if (this._boundIosResizeListener) {
|
|
52
67
|
this._detectIosNavbar();
|
|
@@ -54,6 +69,7 @@ export const NotificationContainerMixin = (superClass) =>
|
|
|
54
69
|
}
|
|
55
70
|
} else {
|
|
56
71
|
document.body.removeChild(this);
|
|
72
|
+
this.hidePopover();
|
|
57
73
|
document.removeEventListener('vaadin-overlay-close', this._boundVaadinOverlayClose);
|
|
58
74
|
if (this._boundIosResizeListener) {
|
|
59
75
|
window.removeEventListener('resize', this._boundIosResizeListener);
|
|
@@ -246,8 +262,6 @@ export const NotificationMixin = (superClass) =>
|
|
|
246
262
|
super.ready();
|
|
247
263
|
|
|
248
264
|
this._overlayElement = this.shadowRoot.querySelector('vaadin-notification-card');
|
|
249
|
-
|
|
250
|
-
processTemplates(this);
|
|
251
265
|
}
|
|
252
266
|
|
|
253
267
|
/** @protected */
|
|
@@ -361,7 +375,11 @@ export const NotificationMixin = (superClass) =>
|
|
|
361
375
|
return;
|
|
362
376
|
}
|
|
363
377
|
|
|
364
|
-
|
|
378
|
+
// Only call bringToFront if the container already has a child / was already opened.
|
|
379
|
+
// Otherwise, just setting `opened` on the container will make it the topmost overlay.
|
|
380
|
+
if (this._container.firstElementChild) {
|
|
381
|
+
this._container.bringToFront();
|
|
382
|
+
}
|
|
365
383
|
|
|
366
384
|
this._card.slot = this.position;
|
|
367
385
|
if (this._container.firstElementChild && /top/u.test(this.position)) {
|
|
@@ -3,20 +3,16 @@
|
|
|
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,
|
|
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 {
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
+
import { notificationCardStyles } from './styles/vaadin-notification-card-core-styles.js';
|
|
14
|
+
import { notificationContainerStyles } from './styles/vaadin-notification-container-core-styles.js';
|
|
10
15
|
import { NotificationContainerMixin, NotificationMixin } from './vaadin-notification-mixin.js';
|
|
11
|
-
import { notificationCardStyles, notificationContainerStyles } from './vaadin-notification-styles.js';
|
|
12
|
-
|
|
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
16
|
|
|
21
17
|
/**
|
|
22
18
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
@@ -28,8 +24,19 @@ registerStyles('vaadin-notification-card', notificationCardStyles, {
|
|
|
28
24
|
* @mixes ThemableMixin
|
|
29
25
|
* @private
|
|
30
26
|
*/
|
|
31
|
-
class NotificationContainer extends NotificationContainerMixin(
|
|
32
|
-
|
|
27
|
+
class NotificationContainer extends NotificationContainerMixin(
|
|
28
|
+
ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
29
|
+
) {
|
|
30
|
+
static get is() {
|
|
31
|
+
return 'vaadin-notification-container';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static get styles() {
|
|
35
|
+
return notificationContainerStyles;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @protected */
|
|
39
|
+
render() {
|
|
33
40
|
return html`
|
|
34
41
|
<div region="top-stretch"><slot name="top-stretch"></slot></div>
|
|
35
42
|
<div region-group="top">
|
|
@@ -46,10 +53,6 @@ class NotificationContainer extends NotificationContainerMixin(ThemableMixin(Ele
|
|
|
46
53
|
<div region="bottom-stretch"><slot name="bottom-stretch"></slot></div>
|
|
47
54
|
`;
|
|
48
55
|
}
|
|
49
|
-
|
|
50
|
-
static get is() {
|
|
51
|
-
return 'vaadin-notification-container';
|
|
52
|
-
}
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
/**
|
|
@@ -60,8 +63,17 @@ class NotificationContainer extends NotificationContainerMixin(ThemableMixin(Ele
|
|
|
60
63
|
* @mixes ThemableMixin
|
|
61
64
|
* @private
|
|
62
65
|
*/
|
|
63
|
-
class NotificationCard extends ThemableMixin(
|
|
64
|
-
static get
|
|
66
|
+
class NotificationCard extends ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))) {
|
|
67
|
+
static get is() {
|
|
68
|
+
return 'vaadin-notification-card';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static get styles() {
|
|
72
|
+
return notificationCardStyles;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @protected */
|
|
76
|
+
render() {
|
|
65
77
|
return html`
|
|
66
78
|
<div part="overlay">
|
|
67
79
|
<div part="content">
|
|
@@ -71,10 +83,6 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
|
|
|
71
83
|
`;
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
static get is() {
|
|
75
|
-
return 'vaadin-notification-card';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
86
|
/** @protected */
|
|
79
87
|
ready() {
|
|
80
88
|
super.ready();
|
|
@@ -134,24 +142,34 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
|
|
|
134
142
|
* @mixes NotificationMixin
|
|
135
143
|
* @mixes ElementMixin
|
|
136
144
|
*/
|
|
137
|
-
class Notification extends NotificationMixin(ElementMixin(
|
|
138
|
-
static get
|
|
145
|
+
class Notification extends NotificationMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
146
|
+
static get is() {
|
|
147
|
+
return 'vaadin-notification';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static get styles() {
|
|
151
|
+
return css`
|
|
152
|
+
:host {
|
|
153
|
+
display: none !important;
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** @protected */
|
|
159
|
+
render() {
|
|
139
160
|
return html`
|
|
140
|
-
<style>
|
|
141
|
-
:host {
|
|
142
|
-
display: none !important;
|
|
143
|
-
}
|
|
144
|
-
</style>
|
|
145
161
|
<vaadin-notification-card
|
|
146
|
-
theme
|
|
147
|
-
aria-live
|
|
162
|
+
theme="${ifDefined(this._theme)}"
|
|
163
|
+
aria-live="${this.__computeAriaLive(this.assertive)}"
|
|
148
164
|
></vaadin-notification-card>
|
|
149
165
|
`;
|
|
150
166
|
}
|
|
151
167
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Fired when the notification is closed.
|
|
170
|
+
*
|
|
171
|
+
* @event closed
|
|
172
|
+
*/
|
|
155
173
|
}
|
|
156
174
|
|
|
157
175
|
defineCustomElement(NotificationContainer);
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED
|
@@ -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,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 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-notification.js';
|