@vaadin/notification 23.2.0-dev.53560527d → 23.2.0
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 +4 -4
- package/package.json +16 -10
- package/src/lit/renderer-directives.d.ts +3 -3
- package/src/vaadin-notification.d.ts +12 -12
- package/src/vaadin-notification.js +1 -1
- package/web-types.json +103 -0
- package/web-types.lit.json +62 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component for providing feedback to the user.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/notification)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/notification)
|
|
8
8
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -19,7 +19,7 @@ A web component for providing feedback to the user.
|
|
|
19
19
|
</script>
|
|
20
20
|
```
|
|
21
21
|
|
|
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/
|
|
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/components/notification)
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -37,7 +37,7 @@ import '@vaadin/notification';
|
|
|
37
37
|
|
|
38
38
|
## Themes
|
|
39
39
|
|
|
40
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
40
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
41
41
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/notification/vaadin-notification.js) of the package uses the Lumo theme.
|
|
42
42
|
|
|
43
43
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -60,7 +60,7 @@ import '@vaadin/notification/src/vaadin-notification.js';
|
|
|
60
60
|
|
|
61
61
|
## Contributing
|
|
62
62
|
|
|
63
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
63
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
64
64
|
|
|
65
65
|
## License
|
|
66
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/notification",
|
|
3
|
-
"version": "23.2.0
|
|
3
|
+
"version": "23.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"src",
|
|
26
26
|
"theme",
|
|
27
27
|
"vaadin-*.d.ts",
|
|
28
|
-
"vaadin-*.js"
|
|
28
|
+
"vaadin-*.js",
|
|
29
|
+
"web-types.json",
|
|
30
|
+
"web-types.lit.json"
|
|
29
31
|
],
|
|
30
32
|
"keywords": [
|
|
31
33
|
"Vaadin",
|
|
@@ -36,19 +38,23 @@
|
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "23.2.0
|
|
40
|
-
"@vaadin/lit-renderer": "23.2.0
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.2.0
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.2.0
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "23.2.0
|
|
41
|
+
"@vaadin/component-base": "^23.2.0",
|
|
42
|
+
"@vaadin/lit-renderer": "^23.2.0",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "^23.2.0",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "^23.2.0",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "^23.2.0",
|
|
44
46
|
"lit": "^2.0.0"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
|
-
"@vaadin/button": "23.2.0
|
|
49
|
-
"@vaadin/polymer-legacy-adapter": "23.2.0
|
|
50
|
+
"@vaadin/button": "^23.2.0",
|
|
51
|
+
"@vaadin/polymer-legacy-adapter": "^23.2.0",
|
|
50
52
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
51
53
|
"sinon": "^13.0.2"
|
|
52
54
|
},
|
|
53
|
-
"
|
|
55
|
+
"web-types": [
|
|
56
|
+
"web-types.json",
|
|
57
|
+
"web-types.lit.json"
|
|
58
|
+
],
|
|
59
|
+
"gitHead": "8b1f5941f26ac41ca038e75e24c8584e331bc7a8"
|
|
54
60
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { TemplateResult } from 'lit';
|
|
7
|
-
import { DirectiveResult } from 'lit/directive.js';
|
|
6
|
+
import type { TemplateResult } from 'lit';
|
|
7
|
+
import type { DirectiveResult } from 'lit/directive.js';
|
|
8
8
|
import { LitRendererDirective } from '@vaadin/lit-renderer';
|
|
9
|
-
import { Notification } from '../vaadin-notification.js';
|
|
9
|
+
import type { Notification } from '../vaadin-notification.js';
|
|
10
10
|
|
|
11
11
|
export type NotificationLitRenderer = (notification: Notification) => TemplateResult;
|
|
12
12
|
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { TemplateResult } from 'lit';
|
|
6
|
+
import type { TemplateResult } from 'lit';
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
10
10
|
|
|
11
11
|
export type NotificationPosition =
|
|
12
|
-
| 'top-stretch'
|
|
13
|
-
| 'top-start'
|
|
14
|
-
| 'top-center'
|
|
15
|
-
| 'top-end'
|
|
16
|
-
| 'middle'
|
|
17
|
-
| 'bottom-start'
|
|
18
12
|
| 'bottom-center'
|
|
19
13
|
| 'bottom-end'
|
|
20
|
-
| 'bottom-
|
|
14
|
+
| 'bottom-start'
|
|
15
|
+
| 'bottom-stretch'
|
|
16
|
+
| 'middle'
|
|
17
|
+
| 'top-center'
|
|
18
|
+
| 'top-end'
|
|
19
|
+
| 'top-start'
|
|
20
|
+
| 'top-stretch';
|
|
21
21
|
|
|
22
22
|
export type NotificationRenderer = (root: HTMLElement, notification?: Notification) => void;
|
|
23
23
|
|
|
@@ -92,7 +92,7 @@ declare class NotificationCard extends ThemableMixin(HTMLElement) {}
|
|
|
92
92
|
* `overlay` | The notification container
|
|
93
93
|
* `content` | The content of the notification
|
|
94
94
|
*
|
|
95
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
95
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
96
96
|
*
|
|
97
97
|
* Note: the `theme` attribute value set on `<vaadin-notification>` is
|
|
98
98
|
* propagated to the internal `<vaadin-notification-card>`.
|
|
@@ -121,7 +121,7 @@ declare class Notification extends ThemePropertyMixin(ElementMixin(HTMLElement))
|
|
|
121
121
|
* @param contents the contents to show, either as a string or a Lit template.
|
|
122
122
|
* @param options optional options for customizing the notification.
|
|
123
123
|
*/
|
|
124
|
-
static show(contents:
|
|
124
|
+
static show(contents: TemplateResult | string, options?: ShowOptions): Notification;
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* The duration in milliseconds to show the notification.
|
|
@@ -171,13 +171,13 @@ declare class Notification extends ThemePropertyMixin(ElementMixin(HTMLElement))
|
|
|
171
171
|
addEventListener<K extends keyof NotificationEventMap>(
|
|
172
172
|
type: K,
|
|
173
173
|
listener: (this: Notification, ev: NotificationEventMap[K]) => void,
|
|
174
|
-
options?:
|
|
174
|
+
options?: AddEventListenerOptions | boolean,
|
|
175
175
|
): void;
|
|
176
176
|
|
|
177
177
|
removeEventListener<K extends keyof NotificationEventMap>(
|
|
178
178
|
type: K,
|
|
179
179
|
listener: (this: Notification, ev: NotificationEventMap[K]) => void,
|
|
180
|
-
options?:
|
|
180
|
+
options?: EventListenerOptions | boolean,
|
|
181
181
|
): void;
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -241,7 +241,7 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
|
|
|
241
241
|
* `overlay` | The notification container
|
|
242
242
|
* `content` | The content of the notification
|
|
243
243
|
*
|
|
244
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
244
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
245
245
|
*
|
|
246
246
|
* Note: the `theme` attribute value set on `<vaadin-notification>` is
|
|
247
247
|
* propagated to the internal `<vaadin-notification-card>`.
|
package/web-types.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/notification",
|
|
4
|
+
"version": "23.2.0",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-notification",
|
|
11
|
+
"description": "`<vaadin-notification>` is a Web Component providing accessible and customizable notifications (toasts).\n\n### Rendering\n\nThe content of the notification can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `notification` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `notification`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-notification id=\"notification\"></vaadin-notification>\n```\n```js\nconst notification = document.querySelector('#notification');\nnotification.renderer = function(root, notification) {\n root.textContent = \"Your work has been saved\";\n};\n```\n\nRenderer is called on the opening of the notification.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\n`<vaadin-notification>` uses `<vaadin-notification-card>` internal\nthemable component as the actual visible notification cards.\n\nThe following shadow DOM parts of the `<vaadin-notification-card>` are available for styling:\n\nPart name | Description\n----------------|----------------\n`overlay` | The notification container\n`content` | The content of the notification\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\nNote: the `theme` attribute value set on `<vaadin-notification>` is\npropagated to the internal `<vaadin-notification-card>`.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "duration",
|
|
15
|
+
"description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"number"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "opened",
|
|
24
|
+
"description": "True if the notification is currently displayed.",
|
|
25
|
+
"value": {
|
|
26
|
+
"type": [
|
|
27
|
+
"boolean"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "position",
|
|
33
|
+
"description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
|
|
34
|
+
"value": {
|
|
35
|
+
"type": [
|
|
36
|
+
"NotificationPosition"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "theme",
|
|
42
|
+
"description": "The theme variants to apply to the component.",
|
|
43
|
+
"value": {
|
|
44
|
+
"type": [
|
|
45
|
+
"string",
|
|
46
|
+
"null",
|
|
47
|
+
"undefined"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"js": {
|
|
53
|
+
"properties": [
|
|
54
|
+
{
|
|
55
|
+
"name": "duration",
|
|
56
|
+
"description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
|
|
57
|
+
"value": {
|
|
58
|
+
"type": [
|
|
59
|
+
"number"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "opened",
|
|
65
|
+
"description": "True if the notification is currently displayed.",
|
|
66
|
+
"value": {
|
|
67
|
+
"type": [
|
|
68
|
+
"boolean"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "position",
|
|
74
|
+
"description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
|
|
75
|
+
"value": {
|
|
76
|
+
"type": [
|
|
77
|
+
"NotificationPosition"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "renderer",
|
|
83
|
+
"description": "Custom function for rendering the content of the notification.\nReceives two arguments:\n\n- `root` The `<vaadin-notification-card>` DOM element. Append\n your content to it.\n- `notification` The reference to the `<vaadin-notification>` element.",
|
|
84
|
+
"value": {
|
|
85
|
+
"type": [
|
|
86
|
+
"NotificationRenderer",
|
|
87
|
+
"undefined"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"events": [
|
|
93
|
+
{
|
|
94
|
+
"name": "opened-changed",
|
|
95
|
+
"description": "Fired when the `opened` property changes."
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/notification",
|
|
4
|
+
"version": "23.2.0",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-notification",
|
|
19
|
+
"description": "`<vaadin-notification>` is a Web Component providing accessible and customizable notifications (toasts).\n\n### Rendering\n\nThe content of the notification can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `notification` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `notification`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-notification id=\"notification\"></vaadin-notification>\n```\n```js\nconst notification = document.querySelector('#notification');\nnotification.renderer = function(root, notification) {\n root.textContent = \"Your work has been saved\";\n};\n```\n\nRenderer is called on the opening of the notification.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\n`<vaadin-notification>` uses `<vaadin-notification-card>` internal\nthemable component as the actual visible notification cards.\n\nThe following shadow DOM parts of the `<vaadin-notification-card>` are available for styling:\n\nPart name | Description\n----------------|----------------\n`overlay` | The notification container\n`content` | The content of the notification\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\nNote: the `theme` attribute value set on `<vaadin-notification>` is\npropagated to the internal `<vaadin-notification-card>`.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?opened",
|
|
24
|
+
"description": "True if the notification is currently displayed.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": ".duration",
|
|
31
|
+
"description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".position",
|
|
38
|
+
"description": "Alignment of the notification in the viewport\nValid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".renderer",
|
|
45
|
+
"description": "Custom function for rendering the content of the notification.\nReceives two arguments:\n\n- `root` The `<vaadin-notification-card>` DOM element. Append\n your content to it.\n- `notification` The reference to the `<vaadin-notification>` element.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "@opened-changed",
|
|
52
|
+
"description": "Fired when the `opened` property changes.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|