@vaadin/notification 22.0.0-alpha9 → 22.0.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
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",
|
|
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",
|
|
37
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.0",
|
|
38
|
+
"@vaadin/vaadin-material-styles": "^22.0.0",
|
|
39
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.0",
|
|
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
|
|
46
|
-
"@vaadin/testing-helpers": "^0.3.
|
|
44
|
+
"@vaadin/button": "^22.0.0",
|
|
45
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.0",
|
|
46
|
+
"@vaadin/testing-helpers": "^0.3.2",
|
|
47
47
|
"sinon": "^9.2.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b668e9b1a975227fbe34beb70d1cd5b03dce2348"
|
|
50
50
|
}
|
|
@@ -35,6 +35,7 @@ export interface NotificationEventMap extends HTMLElementEventMap, NotificationC
|
|
|
35
35
|
export interface ShowOptions {
|
|
36
36
|
duration?: number;
|
|
37
37
|
position?: NotificationPosition;
|
|
38
|
+
theme?: string;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -166,6 +167,7 @@ declare class Notification extends ThemePropertyMixin(ElementMixin(HTMLElement))
|
|
|
166
167
|
* {
|
|
167
168
|
* position?: string
|
|
168
169
|
* duration?: number
|
|
170
|
+
* theme?: string
|
|
169
171
|
* }
|
|
170
172
|
* ```
|
|
171
173
|
*
|
|
@@ -3,9 +3,10 @@
|
|
|
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
|
+
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
11
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
11
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -128,7 +129,7 @@ class NotificationContainer extends ThemableMixin(ElementMixin(PolymerElement))
|
|
|
128
129
|
constructor() {
|
|
129
130
|
super();
|
|
130
131
|
|
|
131
|
-
if (
|
|
132
|
+
if (isIOS) {
|
|
132
133
|
this._boundIosResizeListener = () => this._detectIosNavbar();
|
|
133
134
|
}
|
|
134
135
|
}
|
|
@@ -473,6 +474,7 @@ class Notification extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
473
474
|
* {
|
|
474
475
|
* position?: string
|
|
475
476
|
* duration?: number
|
|
477
|
+
* theme?: string
|
|
476
478
|
* }
|
|
477
479
|
* ```
|
|
478
480
|
*
|
|
@@ -504,6 +506,9 @@ class Notification extends ThemePropertyMixin(ElementMixin(PolymerElement)) {
|
|
|
504
506
|
if (options && options.position) {
|
|
505
507
|
notification.position = options.position;
|
|
506
508
|
}
|
|
509
|
+
if (options && options.theme) {
|
|
510
|
+
notification.setAttribute('theme', options.theme);
|
|
511
|
+
}
|
|
507
512
|
notification.renderer = renderer;
|
|
508
513
|
document.body.appendChild(notification);
|
|
509
514
|
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',
|