@vaadin/notification 24.5.0-rc2 → 24.6.0-alpha2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/notification",
3
- "version": "24.5.0-rc2",
3
+ "version": "24.6.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,16 +38,16 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.0.0",
41
- "@vaadin/component-base": "24.5.0-rc2",
42
- "@vaadin/lit-renderer": "24.5.0-rc2",
43
- "@vaadin/vaadin-lumo-styles": "24.5.0-rc2",
44
- "@vaadin/vaadin-material-styles": "24.5.0-rc2",
45
- "@vaadin/vaadin-themable-mixin": "24.5.0-rc2",
41
+ "@vaadin/component-base": "24.6.0-alpha2",
42
+ "@vaadin/lit-renderer": "24.6.0-alpha2",
43
+ "@vaadin/vaadin-lumo-styles": "24.6.0-alpha2",
44
+ "@vaadin/vaadin-material-styles": "24.6.0-alpha2",
45
+ "@vaadin/vaadin-themable-mixin": "24.6.0-alpha2",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@vaadin/button": "24.5.0-rc2",
50
- "@vaadin/chai-plugins": "24.5.0-rc2",
49
+ "@vaadin/button": "24.6.0-alpha2",
50
+ "@vaadin/chai-plugins": "24.6.0-alpha2",
51
51
  "@vaadin/testing-helpers": "^1.0.0",
52
52
  "sinon": "^18.0.0"
53
53
  },
@@ -55,5 +55,5 @@
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "be5bf40aec33761c6defdb5b3093c7b6dd5d97fd"
58
+ "gitHead": "21fa9ea077a04949a90d00934bfefe3e346bd129"
59
59
  }
@@ -40,6 +40,7 @@ export interface NotificationCustomEventMap {
40
40
  export interface NotificationEventMap extends HTMLElementEventMap, NotificationCustomEventMap {}
41
41
 
42
42
  export interface ShowOptions {
43
+ assertive?: boolean;
43
44
  duration?: number;
44
45
  position?: NotificationPosition;
45
46
  theme?: string;
@@ -116,6 +117,7 @@ declare class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementM
116
117
  *
117
118
  * ```
118
119
  * {
120
+ * assertive?: boolean
119
121
  * position?: string
120
122
  * duration?: number
121
123
  * theme?: string
@@ -123,6 +125,7 @@ declare class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementM
123
125
  * ```
124
126
  *
125
127
  * See the individual documentation for:
128
+ * - [`assertive`](#/elements/vaadin-notification#property-assertive)
126
129
  * - [`position`](#/elements/vaadin-notification#property-position)
127
130
  * - [`duration`](#/elements/vaadin-notification#property-duration)
128
131
  *
@@ -131,6 +134,13 @@ declare class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementM
131
134
  */
132
135
  static show(contents: TemplateResult | string, options?: ShowOptions): Notification;
133
136
 
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
+
134
144
  /**
135
145
  * The duration in milliseconds to show the notification.
136
146
  * Set to `0` or a negative number to disable the notification auto-closing.
@@ -208,7 +208,6 @@ class NotificationCard extends ThemableMixin(PolymerElement) {
208
208
  ready() {
209
209
  super.ready();
210
210
  this.setAttribute('role', 'alert');
211
- this.setAttribute('aria-live', 'polite');
212
211
  }
213
212
  }
214
213
 
@@ -273,7 +272,10 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
273
272
  display: none !important;
274
273
  }
275
274
  </style>
276
- <vaadin-notification-card theme$="[[_theme]]"> </vaadin-notification-card>
275
+ <vaadin-notification-card
276
+ theme$="[[_theme]]"
277
+ aria-live$="[[__computeAriaLive(assertive)]]"
278
+ ></vaadin-notification-card>
277
279
  `;
278
280
  }
279
281
 
@@ -283,6 +285,16 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
283
285
 
284
286
  static get properties() {
285
287
  return {
288
+ /**
289
+ * When true, the notification card has `aria-live` attribute set to
290
+ * `assertive` instead of `polite`. This makes screen readers announce
291
+ * the notification content immediately when it appears.
292
+ */
293
+ assertive: {
294
+ type: Boolean,
295
+ value: false,
296
+ },
297
+
286
298
  /**
287
299
  * The duration in milliseconds to show the notification.
288
300
  * Set to `0` or a negative number to disable the notification auto-closing.
@@ -340,6 +352,7 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
340
352
  *
341
353
  * ```
342
354
  * {
355
+ * assertive?: boolean
343
356
  * position?: string
344
357
  * duration?: number
345
358
  * theme?: string
@@ -347,6 +360,7 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
347
360
  * ```
348
361
  *
349
362
  * See the individual documentation for:
363
+ * - [`assertive`](#/elements/vaadin-notification#property-assertive)
350
364
  * - [`position`](#/elements/vaadin-notification#property-position)
351
365
  * - [`duration`](#/elements/vaadin-notification#property-duration)
352
366
  *
@@ -373,6 +387,9 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
373
387
  if (options && options.position) {
374
388
  notification.position = options.position;
375
389
  }
390
+ if (options && options.assertive) {
391
+ notification.assertive = options.assertive;
392
+ }
376
393
  if (options && options.theme) {
377
394
  notification.setAttribute('theme', options.theme);
378
395
  }
@@ -436,6 +453,11 @@ class Notification extends OverlayClassMixin(ThemePropertyMixin(ElementMixin(Pol
436
453
  this.renderer(this._card, this);
437
454
  }
438
455
 
456
+ /** @private */
457
+ __computeAriaLive(assertive) {
458
+ return assertive ? 'assertive' : 'polite';
459
+ }
460
+
439
461
  /** @private */
440
462
  _rendererChanged(renderer, opened, card) {
441
463
  if (!card) {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/notification",
4
- "version": "24.5.0-rc2",
4
+ "version": "24.6.0-alpha2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -21,6 +21,17 @@
21
21
  ]
22
22
  }
23
23
  },
24
+ {
25
+ "name": "assertive",
26
+ "description": "When true, the notification card has `aria-live` attribute set to\n`assertive` instead of `polite`. This makes screen readers announce\nthe notification content immediately when it appears.",
27
+ "value": {
28
+ "type": [
29
+ "boolean",
30
+ "null",
31
+ "undefined"
32
+ ]
33
+ }
34
+ },
24
35
  {
25
36
  "name": "duration",
26
37
  "description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
@@ -73,6 +84,17 @@
73
84
  ]
74
85
  }
75
86
  },
87
+ {
88
+ "name": "assertive",
89
+ "description": "When true, the notification card has `aria-live` attribute set to\n`assertive` instead of `polite`. This makes screen readers announce\nthe notification content immediately when it appears.",
90
+ "value": {
91
+ "type": [
92
+ "boolean",
93
+ "null",
94
+ "undefined"
95
+ ]
96
+ }
97
+ },
76
98
  {
77
99
  "name": "duration",
78
100
  "description": "The duration in milliseconds to show the notification.\nSet to `0` or a negative number to disable the notification auto-closing.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/notification",
4
- "version": "24.5.0-rc2",
4
+ "version": "24.6.0-alpha2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -19,6 +19,13 @@
19
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/styling-components) documentation.\n\nNote: the `theme` attribute value set on `<vaadin-notification>` is\npropagated to the internal `<vaadin-notification-card>`.",
20
20
  "extension": true,
21
21
  "attributes": [
22
+ {
23
+ "name": "?assertive",
24
+ "description": "When true, the notification card has `aria-live` attribute set to\n`assertive` instead of `polite`. This makes screen readers announce\nthe notification content immediately when it appears.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
22
29
  {
23
30
  "name": "?opened",
24
31
  "description": "True if the notification is currently displayed.",