@vaadin/notification 22.0.0-alpha7 → 22.0.0-beta2
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 +25 -24
- package/package.json +8 -8
- package/src/vaadin-notification.d.ts +36 -8
- package/src/vaadin-notification.js +5 -12
- package/theme/lumo/vaadin-notification-styles.js +1 -1
- package/theme/material/vaadin-notification-styles.js +2 -2
- package/vaadin-notification.d.ts +0 -1
- package/src/interfaces.d.ts +0 -30
package/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vaadin/notification
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
|
5
|
-
[API documentation ↗](https://vaadin.com/components/vaadin-notification/html-api)
|
|
3
|
+
A web component for providing feedback to the user.
|
|
6
4
|
|
|
7
|
-
[
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/notification)
|
|
8
6
|
|
|
9
7
|
[](https://www.npmjs.com/package/@vaadin/notification)
|
|
10
|
-
[](https://vaadin.com/directory/component/vaadinvaadin-notification)
|
|
11
8
|
[](https://discord.gg/PHmkCKC)
|
|
12
9
|
|
|
13
10
|
```html
|
|
@@ -22,41 +19,44 @@
|
|
|
22
19
|
</script>
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
[<img src="https://raw.githubusercontent.com/vaadin/
|
|
22
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/notification/screenshot.png" width="336" alt="Screenshot of vaadin-notification">](https://vaadin.com/docs/latest/ds/components/notification)
|
|
26
23
|
|
|
27
24
|
## Installation
|
|
28
25
|
|
|
29
|
-
Install
|
|
26
|
+
Install the component:
|
|
30
27
|
|
|
31
28
|
```sh
|
|
32
|
-
npm i @vaadin/notification
|
|
29
|
+
npm i @vaadin/notification
|
|
33
30
|
```
|
|
34
31
|
|
|
35
|
-
Once installed, import
|
|
32
|
+
Once installed, import the component in your application:
|
|
36
33
|
|
|
37
34
|
```js
|
|
38
|
-
import '@vaadin/notification
|
|
35
|
+
import '@vaadin/notification';
|
|
39
36
|
```
|
|
40
37
|
|
|
41
|
-
##
|
|
38
|
+
## Themes
|
|
42
39
|
|
|
43
|
-
Vaadin components
|
|
40
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
|
|
41
|
+
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/notification/vaadin-notification.js) of the package uses the Lumo theme.
|
|
44
42
|
|
|
45
|
-
To use the Material theme, import the
|
|
43
|
+
To use the Material theme, import the component from the `theme/material` folder:
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
`theme/lumo/vaadin-notification.js`
|
|
45
|
+
```js
|
|
46
|
+
import '@vaadin/notification/theme/material/vaadin-notification.js';
|
|
47
|
+
```
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
You can also import the Lumo version of the component explicitly:
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
```js
|
|
52
|
+
import '@vaadin/notification/theme/lumo/vaadin-notification.js';
|
|
53
|
+
```
|
|
56
54
|
|
|
57
|
-
-
|
|
55
|
+
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
```js
|
|
58
|
+
import '@vaadin/notification/src/vaadin-notification.js';
|
|
59
|
+
```
|
|
60
60
|
|
|
61
61
|
## Contributing
|
|
62
62
|
|
|
@@ -66,4 +66,5 @@ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/
|
|
|
66
66
|
|
|
67
67
|
Apache License 2.0
|
|
68
68
|
|
|
69
|
-
Vaadin collects development time
|
|
69
|
+
Vaadin collects usage statistics at development time to improve this product.
|
|
70
|
+
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/notification",
|
|
3
|
-
"version": "22.0.0-
|
|
3
|
+
"version": "22.0.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/component-base": "22.0.0-
|
|
37
|
-
"@vaadin/vaadin-lumo-styles": "22.0.0-
|
|
38
|
-
"@vaadin/vaadin-material-styles": "22.0.0-
|
|
39
|
-
"@vaadin/vaadin-themable-mixin": "22.0.0-
|
|
36
|
+
"@vaadin/component-base": "22.0.0-beta2",
|
|
37
|
+
"@vaadin/vaadin-lumo-styles": "22.0.0-beta2",
|
|
38
|
+
"@vaadin/vaadin-material-styles": "22.0.0-beta2",
|
|
39
|
+
"@vaadin/vaadin-themable-mixin": "22.0.0-beta2",
|
|
40
40
|
"lit": "^2.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@esm-bundle/chai": "^4.3.4",
|
|
44
|
-
"@vaadin/button": "22.0.0-
|
|
45
|
-
"@vaadin/polymer-legacy-adapter": "22.0.0-
|
|
44
|
+
"@vaadin/button": "22.0.0-beta2",
|
|
45
|
+
"@vaadin/polymer-legacy-adapter": "22.0.0-beta2",
|
|
46
46
|
"@vaadin/testing-helpers": "^0.3.0",
|
|
47
47
|
"sinon": "^9.2.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f13833683e6667f6ca6678452db14aa6b7eac4a4"
|
|
50
50
|
}
|
|
@@ -1,8 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
1
6
|
import { TemplateResult } from 'lit';
|
|
2
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
3
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
9
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
5
|
-
|
|
10
|
+
|
|
11
|
+
export type NotificationPosition =
|
|
12
|
+
| 'top-stretch'
|
|
13
|
+
| 'top-start'
|
|
14
|
+
| 'top-center'
|
|
15
|
+
| 'top-end'
|
|
16
|
+
| 'middle'
|
|
17
|
+
| 'bottom-start'
|
|
18
|
+
| 'bottom-center'
|
|
19
|
+
| 'bottom-end'
|
|
20
|
+
| 'bottom-stretch';
|
|
21
|
+
|
|
22
|
+
export type NotificationRenderer = (root: HTMLElement, notification?: Notification) => void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Fired when the `opened` property changes.
|
|
26
|
+
*/
|
|
27
|
+
export type NotificationOpenedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
28
|
+
|
|
29
|
+
export interface NotificationCustomEventMap {
|
|
30
|
+
'opened-changed': NotificationOpenedChangedEvent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NotificationEventMap extends HTMLElementEventMap, NotificationCustomEventMap {}
|
|
34
|
+
|
|
35
|
+
export interface ShowOptions {
|
|
36
|
+
duration?: number;
|
|
37
|
+
position?: NotificationPosition;
|
|
38
|
+
theme?: string;
|
|
39
|
+
}
|
|
6
40
|
|
|
7
41
|
/**
|
|
8
42
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
@@ -101,13 +135,6 @@ declare class Notification extends ThemePropertyMixin(ElementMixin(HTMLElement))
|
|
|
101
135
|
*/
|
|
102
136
|
requestContentUpdate(): void;
|
|
103
137
|
|
|
104
|
-
/**
|
|
105
|
-
* Manually invoke existing renderer.
|
|
106
|
-
*
|
|
107
|
-
* @deprecated Since Vaadin 21, `render()` is deprecated. Please use `requestContentUpdate()` instead.
|
|
108
|
-
*/
|
|
109
|
-
render(): void;
|
|
110
|
-
|
|
111
138
|
/**
|
|
112
139
|
* Opens the notification.
|
|
113
140
|
*/
|
|
@@ -140,6 +167,7 @@ declare class Notification extends ThemePropertyMixin(ElementMixin(HTMLElement))
|
|
|
140
167
|
* {
|
|
141
168
|
* position?: string
|
|
142
169
|
* duration?: number
|
|
170
|
+
* theme?: string
|
|
143
171
|
* }
|
|
144
172
|
* ```
|
|
145
173
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
7
|
import { render } from 'lit';
|
|
8
8
|
import { isTemplateResult } from 'lit/directive-helpers.js';
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -325,17 +325,6 @@ class Notification extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
325
325
|
this.renderer(this._card, this);
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
/**
|
|
329
|
-
* Manually invoke existing renderer.
|
|
330
|
-
*
|
|
331
|
-
* @deprecated Since Vaadin 21, `render()` is deprecated. Please use `requestContentUpdate()` instead.
|
|
332
|
-
*/
|
|
333
|
-
render() {
|
|
334
|
-
console.warn('WARNING: Since Vaadin 21, render() is deprecated. Please use requestContentUpdate() instead.');
|
|
335
|
-
|
|
336
|
-
this.requestContentUpdate();
|
|
337
|
-
}
|
|
338
|
-
|
|
339
328
|
/** @private */
|
|
340
329
|
_rendererChanged(renderer, opened, card) {
|
|
341
330
|
if (!card) {
|
|
@@ -484,6 +473,7 @@ class Notification extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
484
473
|
* {
|
|
485
474
|
* position?: string
|
|
486
475
|
* duration?: number
|
|
476
|
+
* theme?: string
|
|
487
477
|
* }
|
|
488
478
|
* ```
|
|
489
479
|
*
|
|
@@ -515,6 +505,9 @@ class Notification extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
515
505
|
if (options && options.position) {
|
|
516
506
|
notification.position = options.position;
|
|
517
507
|
}
|
|
508
|
+
if (options && options.theme) {
|
|
509
|
+
notification.setAttribute('theme', options.theme);
|
|
510
|
+
}
|
|
518
511
|
notification.renderer = renderer;
|
|
519
512
|
document.body.appendChild(notification);
|
|
520
513
|
notification.opened = true;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
4
3
|
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
5
4
|
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
5
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
6
|
|
|
7
7
|
registerStyles(
|
|
8
8
|
'vaadin-notification-card',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
|
-
import { colorDark } from '@vaadin/vaadin-material-styles/color.js';
|
|
3
1
|
import '@vaadin/vaadin-material-styles/typography.js';
|
|
4
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
5
|
|
|
6
6
|
registerStyles(
|
|
7
7
|
'vaadin-notification-container',
|
package/vaadin-notification.d.ts
CHANGED
package/src/interfaces.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Notification } from './vaadin-notification';
|
|
2
|
-
|
|
3
|
-
export type NotificationPosition =
|
|
4
|
-
| 'top-stretch'
|
|
5
|
-
| 'top-start'
|
|
6
|
-
| 'top-center'
|
|
7
|
-
| 'top-end'
|
|
8
|
-
| 'middle'
|
|
9
|
-
| 'bottom-start'
|
|
10
|
-
| 'bottom-center'
|
|
11
|
-
| 'bottom-end'
|
|
12
|
-
| 'bottom-stretch';
|
|
13
|
-
|
|
14
|
-
export type NotificationRenderer = (root: HTMLElement, notification?: Notification) => void;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Fired when the `opened` property changes.
|
|
18
|
-
*/
|
|
19
|
-
export type NotificationOpenedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
20
|
-
|
|
21
|
-
export interface NotificationCustomEventMap {
|
|
22
|
-
'opened-changed': NotificationOpenedChangedEvent;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface NotificationEventMap extends HTMLElementEventMap, NotificationCustomEventMap {}
|
|
26
|
-
|
|
27
|
-
export interface ShowOptions {
|
|
28
|
-
duration?: number;
|
|
29
|
-
position?: NotificationPosition;
|
|
30
|
-
}
|