@brightspace-ui/core 3.345.0 → 3.346.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.
|
@@ -147,7 +147,7 @@ Use a toast alert to provide feedback about an operation the user has just initi
|
|
|
147
147
|
|`type`| String, default: `'default'` | The type of the alert being displayed. Can be one of `default`, `critical`, `success` , `warning` |
|
|
148
148
|
|
|
149
149
|
### Events
|
|
150
|
-
* `d2l-alert-toast-close`: dispatched when the toast is closed
|
|
150
|
+
* `d2l-alert-toast-close`: dispatched when the toast is closed. The `detail` contains a `closeComplete` promise that resolves when the toast's animation completes or it is reopened.
|
|
151
151
|
<!-- docs: end hidden content -->
|
|
152
152
|
|
|
153
153
|
### Multiple Toast Alerts
|
|
@@ -41,7 +41,7 @@ let ALERT_HAS_HOVER = false; // if this alert or sibling alert is hovered on
|
|
|
41
41
|
* A component for communicating important information relating to the state of the system and the user's work flow, displayed as a pop-up at the bottom of the screen that automatically dismisses itself by default.
|
|
42
42
|
* @slot - Default content placed inside of the component
|
|
43
43
|
* @fires d2l-alert-toast-button-press - Dispatched when the toast's action button is clicked
|
|
44
|
-
* @fires d2l-alert-toast-close - Dispatched when the toast is closed
|
|
44
|
+
* @fires d2l-alert-toast-close - Dispatched when the toast is closed. The `detail` contains a `closeComplete` promise that resolves when the toast's animation completes or it is reopened.
|
|
45
45
|
*/
|
|
46
46
|
class AlertToast extends LitElement {
|
|
47
47
|
|
|
@@ -403,6 +403,7 @@ class AlertToast extends LitElement {
|
|
|
403
403
|
this._totalSiblingHeightBelow = 0;
|
|
404
404
|
this._numAlertsBelow = 0;
|
|
405
405
|
this._closeClicked = false;
|
|
406
|
+
this._closeCompleteResolve?.();
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
_onTransitionEnd() {
|
|
@@ -425,6 +426,8 @@ class AlertToast extends LitElement {
|
|
|
425
426
|
|
|
426
427
|
if (this._state === states.CLOSING) {
|
|
427
428
|
this._state = states.OPENING;
|
|
429
|
+
// Make sure to resolve the previous closeComplete promise if we are reopening mid-close
|
|
430
|
+
this._closeCompleteResolve?.();
|
|
428
431
|
} else if (this._state === states.CLOSED) {
|
|
429
432
|
if (!activeReduceMotion) {
|
|
430
433
|
this._state = states.PREOPENING;
|
|
@@ -441,6 +444,8 @@ class AlertToast extends LitElement {
|
|
|
441
444
|
} else {
|
|
442
445
|
if (!this._innerContainer) return;
|
|
443
446
|
|
|
447
|
+
const closeComplete = new Promise(resolve => this._closeCompleteResolve = resolve);
|
|
448
|
+
|
|
444
449
|
if (activeReduceMotion || this._state === states.PREOPENING) {
|
|
445
450
|
cancelAnimationFrame(this._preopenFrame);
|
|
446
451
|
} else if (this._state === states.OPENING || this._state === states.OPEN || this._state === states.SLIDING) {
|
|
@@ -461,7 +466,7 @@ class AlertToast extends LitElement {
|
|
|
461
466
|
'd2l-alert-toast-close', {
|
|
462
467
|
bubbles: true,
|
|
463
468
|
composed: true,
|
|
464
|
-
detail: { bottom, heightDifference: -this._height, opening: false, closing: true }
|
|
469
|
+
detail: { bottom, closeComplete, heightDifference: -this._height, opening: false, closing: true }
|
|
465
470
|
}
|
|
466
471
|
));
|
|
467
472
|
});
|
package/custom-elements.json
CHANGED
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"name": "d2l-alert-toast-close",
|
|
97
|
-
"description": "Dispatched when the toast is closed"
|
|
97
|
+
"description": "Dispatched when the toast is closed. The `detail` contains a `closeComplete` promise that resolves when the toast's animation completes or it is reopened."
|
|
98
98
|
}
|
|
99
99
|
],
|
|
100
100
|
"slots": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.346.0",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|