@brightspace-ui/core 2.45.3 → 2.45.4

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.
@@ -15,6 +15,7 @@ const states = {
15
15
  /**
16
16
  * 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.
17
17
  * @slot - Default content placed inside of the component
18
+ * @fires d2l-alert-toast-button-press - Dispatched when the toast's action button is clicked
18
19
  * @fires d2l-alert-toast-close - Dispatched when the toast is closed
19
20
  */
20
21
  class AlertToast extends LitElement {
@@ -149,6 +150,7 @@ class AlertToast extends LitElement {
149
150
  <d2l-alert
150
151
  @blur=${this._onBlur}
151
152
  button-text="${ifDefined(this.buttonText)}"
153
+ @d2l-alert-button-press=${this._handleButtonPress}
152
154
  @d2l-alert-close=${this._onCloseClicked}
153
155
  @focus=${this._onFocus}
154
156
  ?has-close-button="${!this.hideCloseButton}"
@@ -198,6 +200,11 @@ class AlertToast extends LitElement {
198
200
  clearTimeout(this._setTimeoutId);
199
201
  }
200
202
 
203
+ _handleButtonPress(e) {
204
+ e.stopPropagation();
205
+ this.dispatchEvent(new CustomEvent('d2l-alert-toast-button-press'));
206
+ }
207
+
201
208
  _onBlur() {
202
209
  this._hasFocus = false;
203
210
  this._closeTimerStart();
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
  </d2l-demo-snippet>
42
42
 
43
- <h2>With Subtext</h2>
43
+ <h2>With Subtext and Button</h2>
44
44
  <d2l-demo-snippet>
45
45
  <template>
46
46
  <d2l-alert-toast id="toast4" type="success" button-text="Do it!" has-close-button
@@ -68,6 +68,11 @@
68
68
  });
69
69
  });
70
70
 
71
+ const buttonAlertToast = document.querySelector('#toast4');
72
+ buttonAlertToast.addEventListener('d2l-alert-toast-button-press', (e) => {
73
+ console.log('d2l-alert-toast-button-press', e);
74
+ });
75
+
71
76
  document.body.addEventListener('d2l-alert-toast-close', (e) => {
72
77
  console.log('d2l-alert-toast-close', e);
73
78
  });
@@ -84,6 +84,10 @@
84
84
  }
85
85
  ],
86
86
  "events": [
87
+ {
88
+ "name": "d2l-alert-toast-button-press",
89
+ "description": "Dispatched when the toast's action button is clicked"
90
+ },
87
91
  {
88
92
  "name": "d2l-alert-toast-close",
89
93
  "description": "Dispatched when the toast is closed"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.45.3",
3
+ "version": "2.45.4",
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",