@vaadin/notification 24.6.0-alpha4 → 24.6.0-alpha6
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/package.json +10 -9
- package/src/vaadin-lit-notification.js +129 -0
- package/src/vaadin-notification-mixin.d.ts +92 -0
- package/src/vaadin-notification-mixin.js +434 -0
- package/src/vaadin-notification-styles.js +71 -0
- package/src/vaadin-notification.d.ts +14 -79
- package/src/vaadin-notification.js +15 -468
- package/theme/lumo/vaadin-lit-notification.d.ts +2 -0
- package/theme/lumo/vaadin-lit-notification.js +2 -0
- package/theme/material/vaadin-lit-notification.d.ts +2 -0
- package/theme/material/vaadin-lit-notification.js +2 -0
- package/vaadin-lit-notification.d.ts +1 -0
- package/vaadin-lit-notification.js +2 -0
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2024 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 notificationContainerStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
position: fixed;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
inset: 0;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[region-group] {
|
|
21
|
+
flex: 1 1 0%;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[region-group='top'] {
|
|
26
|
+
align-items: flex-start;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[region-group='bottom'] {
|
|
30
|
+
align-items: flex-end;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[region-group] > [region] {
|
|
34
|
+
flex: 1 1 0%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media (max-width: 420px) {
|
|
38
|
+
[region-group] {
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: stretch;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[region-group='top'] {
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[region-group='bottom'] {
|
|
48
|
+
justify-content: flex-end;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[region-group] > [region] {
|
|
52
|
+
flex: initial;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
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
|
+
`;
|
|
@@ -5,22 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { TemplateResult } from 'lit';
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
9
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
NotificationContainerMixin,
|
|
11
|
+
NotificationMixin,
|
|
12
|
+
type NotificationPosition,
|
|
13
|
+
} from './vaadin-notification-mixin.js';
|
|
11
14
|
|
|
12
|
-
export
|
|
13
|
-
| 'bottom-center'
|
|
14
|
-
| 'bottom-end'
|
|
15
|
-
| 'bottom-start'
|
|
16
|
-
| 'bottom-stretch'
|
|
17
|
-
| 'middle'
|
|
18
|
-
| 'top-center'
|
|
19
|
-
| 'top-end'
|
|
20
|
-
| 'top-start'
|
|
21
|
-
| 'top-stretch';
|
|
15
|
+
export * from './vaadin-notification-mixin.js';
|
|
22
16
|
|
|
23
|
-
export
|
|
17
|
+
export interface ShowOptions {
|
|
18
|
+
assertive?: boolean;
|
|
19
|
+
duration?: number;
|
|
20
|
+
position?: NotificationPosition;
|
|
21
|
+
theme?: string;
|
|
22
|
+
}
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Fired when the `opened` property changes.
|
|
@@ -39,22 +38,10 @@ export interface NotificationCustomEventMap {
|
|
|
39
38
|
|
|
40
39
|
export interface NotificationEventMap extends HTMLElementEventMap, NotificationCustomEventMap {}
|
|
41
40
|
|
|
42
|
-
export interface ShowOptions {
|
|
43
|
-
assertive?: boolean;
|
|
44
|
-
duration?: number;
|
|
45
|
-
position?: NotificationPosition;
|
|
46
|
-
theme?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
41
|
/**
|
|
50
42
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
51
43
|
*/
|
|
52
|
-
declare class NotificationContainer extends ElementMixin(ThemableMixin(HTMLElement)) {
|
|
53
|
-
/**
|
|
54
|
-
* True when the container is opened
|
|
55
|
-
*/
|
|
56
|
-
opened: boolean;
|
|
57
|
-
}
|
|
44
|
+
declare class NotificationContainer extends NotificationContainerMixin(ElementMixin(ThemableMixin(HTMLElement))) {}
|
|
58
45
|
|
|
59
46
|
/**
|
|
60
47
|
* An element used internally by `<vaadin-notification>`. Not intended to be used separately.
|
|
@@ -108,7 +95,7 @@ declare class NotificationCard extends ThemableMixin(HTMLElement) {}
|
|
|
108
95
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
109
96
|
* @fires {CustomEvent} closed - Fired when the notification is closed.
|
|
110
97
|
*/
|
|
111
|
-
declare class Notification extends
|
|
98
|
+
declare class Notification extends NotificationMixin(ElementMixin(HTMLElement)) {
|
|
112
99
|
/**
|
|
113
100
|
* Shows a notification with the given content.
|
|
114
101
|
* By default, positions the notification at `bottom-start` and uses a 5 second duration.
|
|
@@ -134,58 +121,6 @@ declare class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementM
|
|
|
134
121
|
*/
|
|
135
122
|
static show(contents: TemplateResult | string, options?: ShowOptions): Notification;
|
|
136
123
|
|
|
137
|
-
/**
|
|
138
|
-
* When true, the notification card has `aria-live` attribute set to
|
|
139
|
-
* `assertive` instead of `polite`. This makes screen readers announce
|
|
140
|
-
* the notification content immediately when it appears.
|
|
141
|
-
*/
|
|
142
|
-
assertive: boolean;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* The duration in milliseconds to show the notification.
|
|
146
|
-
* Set to `0` or a negative number to disable the notification auto-closing.
|
|
147
|
-
*/
|
|
148
|
-
duration: number;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* True if the notification is currently displayed.
|
|
152
|
-
*/
|
|
153
|
-
opened: boolean;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Alignment of the notification in the viewport
|
|
157
|
-
* Valid values are `top-stretch|top-start|top-center|top-end|middle|bottom-start|bottom-center|bottom-end|bottom-stretch`
|
|
158
|
-
*/
|
|
159
|
-
position: NotificationPosition;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Custom function for rendering the content of the notification.
|
|
163
|
-
* Receives two arguments:
|
|
164
|
-
*
|
|
165
|
-
* - `root` The `<vaadin-notification-card>` DOM element. Append
|
|
166
|
-
* your content to it.
|
|
167
|
-
* - `notification` The reference to the `<vaadin-notification>` element.
|
|
168
|
-
*/
|
|
169
|
-
renderer: NotificationRenderer | undefined;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Requests an update for the content of the notification.
|
|
173
|
-
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
174
|
-
*
|
|
175
|
-
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
176
|
-
*/
|
|
177
|
-
requestContentUpdate(): void;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Opens the notification.
|
|
181
|
-
*/
|
|
182
|
-
open(): void;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Closes the notification.
|
|
186
|
-
*/
|
|
187
|
-
close(): void;
|
|
188
|
-
|
|
189
124
|
addEventListener<K extends keyof NotificationEventMap>(
|
|
190
125
|
type: K,
|
|
191
126
|
listener: (this: Notification, ev: NotificationEventMap[K]) => void,
|