@brightspace-ui/core 2.11.1 → 2.13.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.
@@ -81,6 +81,7 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
81
81
 
82
82
  - `d2l-dialog-open`: dispatched when the dialog is opened
83
83
  - `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
84
+ - `d2l-dialog-before-close`: dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing
84
85
  <!-- docs: end hidden content -->
85
86
 
86
87
  ### Accessibility Properties
@@ -192,6 +193,7 @@ The `d2l-dialog-confirm` element is a simple confirmation dialog for prompting t
192
193
 
193
194
  - `d2l-dialog-open`: dispatched when the dialog is opened
194
195
  - `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
196
+ - `d2l-dialog-before-close`: dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing
195
197
  <!-- docs: end hidden content -->
196
198
 
197
199
  ### Usage
@@ -249,6 +251,7 @@ The `d2l-dialog-fullscreen` element is a fullscreen variant of the generic `d2l-
249
251
 
250
252
  - `d2l-dialog-open`: dispatched when the dialog is opened
251
253
  - `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
254
+ - `d2l-dialog-before-close`: dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing
252
255
  <!-- docs: end hidden content -->
253
256
 
254
257
  ### Usage
@@ -13,8 +13,13 @@
13
13
  import '../dialog-fullscreen.js';
14
14
  import './dialog-async-content.js';
15
15
  import '../../dropdown/dropdown.js';
16
+ import '../../dropdown/dropdown-button-subtle.js';
17
+ import '../../dropdown/dropdown-content.js';
16
18
  import '../../dropdown/dropdown-more.js';
17
19
  import '../../dropdown/dropdown-menu.js';
20
+ import '../../filter/filter.js';
21
+ import '../../filter/filter-dimension-set.js';
22
+ import '../../filter/filter-dimension-set-value.js';
18
23
  import '../../menu/menu.js';
19
24
  import '../../menu/menu-item.js';
20
25
  import '../../tabs/tabs.js';
@@ -48,6 +53,28 @@
48
53
  <p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
49
54
  <p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
50
55
  <p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
56
+ <d2l-dropdown-button-subtle text="More">
57
+ <d2l-dropdown-content mobile-tray="bottom">
58
+ <p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
59
+ <p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
60
+ <p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
61
+ </d2l-dropdown-content>
62
+ </d2l-dropdown-button-subtle>
63
+ <d2l-filter>
64
+ <d2l-filter-dimension-set key="course" text="Course" select-all>
65
+ <d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
66
+ <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" selected></d2l-filter-dimension-set-value>
67
+ <d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
68
+ <d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
69
+ <d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
70
+ <d2l-filter-dimension-set-value key="english" text="English"></d2l-filter-dimension-set-value>
71
+ <d2l-filter-dimension-set-value key="how-to" text="How To Write a How To Article With a Flashy Title"></d2l-filter-dimension-set-value>
72
+ <d2l-filter-dimension-set-value key="math" text="Math"></d2l-filter-dimension-set-value>
73
+ <d2l-filter-dimension-set-value key="physics" text="Physics"></d2l-filter-dimension-set-value>
74
+ <d2l-filter-dimension-set-value key="stats" text="Statistics"></d2l-filter-dimension-set-value>
75
+ <d2l-filter-dimension-set-value key="writerscraft" text="Writer's Craft"></d2l-filter-dimension-set-value>
76
+ </d2l-filter-dimension-set>
77
+ </d2l-filter>
51
78
  <d2l-button slot="footer" primary data-dialog-action="save">Save</d2l-button>
52
79
  <d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
53
80
  </d2l-dialog-fullscreen>
@@ -10,8 +10,12 @@
10
10
  <script type="module">
11
11
  import '../../demo/demo-page.js';
12
12
  import '../../button/button.js';
13
+ import '../../dropdown/dropdown-button-subtle.js';
14
+ import '../../dropdown/dropdown-content.js';
15
+ import '../../filter/filter.js';
16
+ import '../../filter/filter-dimension-set.js';
17
+ import '../../filter/filter-dimension-set-value.js';
13
18
  import '../dialog.js';
14
- import '../dialog-confirm.js';
15
19
  </script>
16
20
  <style>
17
21
  #openChild {
@@ -40,6 +44,28 @@
40
44
  <div>
41
45
  Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.
42
46
  Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.
47
+ <d2l-dropdown-button-subtle text="More">
48
+ <d2l-dropdown-content mobile-tray="left">
49
+ <p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
50
+ <p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
51
+ <p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
52
+ </d2l-dropdown-content>
53
+ </d2l-dropdown-button-subtle>
54
+ <d2l-filter>
55
+ <d2l-filter-dimension-set key="course" text="Course" select-all>
56
+ <d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
57
+ <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" selected></d2l-filter-dimension-set-value>
58
+ <d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
59
+ <d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
60
+ <d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
61
+ <d2l-filter-dimension-set-value key="english" text="English"></d2l-filter-dimension-set-value>
62
+ <d2l-filter-dimension-set-value key="how-to" text="How To Write a How To Article With a Flashy Title"></d2l-filter-dimension-set-value>
63
+ <d2l-filter-dimension-set-value key="math" text="Math"></d2l-filter-dimension-set-value>
64
+ <d2l-filter-dimension-set-value key="physics" text="Physics"></d2l-filter-dimension-set-value>
65
+ <d2l-filter-dimension-set-value key="stats" text="Statistics"></d2l-filter-dimension-set-value>
66
+ <d2l-filter-dimension-set-value key="writerscraft" text="Writer's Craft"></d2l-filter-dimension-set-value>
67
+ </d2l-filter-dimension-set>
68
+ </d2l-filter>
43
69
  </div>
44
70
  <d2l-button slot="footer" primary data-dialog-action="child ok">Child</d2l-button>
45
71
  <d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
@@ -10,6 +10,11 @@
10
10
  <script type="module">
11
11
  import '../../demo/demo-page.js';
12
12
  import '../../button/button.js';
13
+ import '../../dropdown/dropdown-button-subtle.js';
14
+ import '../../dropdown/dropdown-content.js';
15
+ import '../../filter/filter.js';
16
+ import '../../filter/filter-dimension-set.js';
17
+ import '../../filter/filter-dimension-set-value.js';
13
18
  import '../dialog.js';
14
19
  import './dialog-async-content.js';
15
20
  import './dialog-container.js';
@@ -33,6 +38,28 @@
33
38
  <p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
34
39
  <p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
35
40
  <p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
41
+ <d2l-dropdown-button-subtle text="More">
42
+ <d2l-dropdown-content mobile-tray="right">
43
+ <p>Deadlights jack lad schooner scallywag dance the hempen jig carouser broadside cable strike colors. Bring a spring upon her cable holystone blow the man down spanker</p>
44
+ <p>Shiver me timbers to go on account lookout wherry doubloon chase. Belay yo-ho-ho keelhaul squiffy black spot yardarm spyglass sheet transom heave to.</p>
45
+ <p>Trysail Sail ho Corsair red ensign hulk smartly boom jib rum gangway. Case shot Shiver me timbers gangplank crack Jennys tea cup ballast Blimey lee snow crow's nest rutters. Fluke jib scourge of the seven seas boatswain schooner gaff booty Jack Tar transom spirits.</p>
46
+ </d2l-dropdown-content>
47
+ </d2l-dropdown-button-subtle>
48
+ <d2l-filter>
49
+ <d2l-filter-dimension-set key="course" text="Course" select-all>
50
+ <d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
51
+ <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" selected></d2l-filter-dimension-set-value>
52
+ <d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
53
+ <d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
54
+ <d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
55
+ <d2l-filter-dimension-set-value key="english" text="English"></d2l-filter-dimension-set-value>
56
+ <d2l-filter-dimension-set-value key="how-to" text="How To Write a How To Article With a Flashy Title"></d2l-filter-dimension-set-value>
57
+ <d2l-filter-dimension-set-value key="math" text="Math"></d2l-filter-dimension-set-value>
58
+ <d2l-filter-dimension-set-value key="physics" text="Physics"></d2l-filter-dimension-set-value>
59
+ <d2l-filter-dimension-set-value key="stats" text="Statistics"></d2l-filter-dimension-set-value>
60
+ <d2l-filter-dimension-set-value key="writerscraft" text="Writer's Craft"></d2l-filter-dimension-set-value>
61
+ </d2l-filter-dimension-set>
62
+ </d2l-filter>
36
63
  </div>
37
64
  <d2l-button slot="footer" primary data-dialog-action="ok">Click Me!</d2l-button>
38
65
  <d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
@@ -104,6 +131,57 @@
104
131
  </template>
105
132
  </d2l-demo-snippet>
106
133
 
134
+ <h2>Dialog (intercept closing)</h2>
135
+
136
+ <d2l-demo-snippet>
137
+ <template>
138
+ <d2l-button id="openInterceptClosing">Show Dialog</d2l-button>
139
+ <d2l-dialog id="dialogInterceptClosing" title-text="Dialog Prevent Closing">
140
+ <div>
141
+ <p>This dialog is prevented from closing by listening "d2l-dialog-before-close" event.</p>
142
+ <d2l-dialog id="dialogConfirmClose" title-text="Comfirm close">
143
+ <div>
144
+ <p>Do you really want to close the previous dialog?</p>
145
+ </div>
146
+ <d2l-button slot="footer" primary data-dialog-action="confirm">Yes</d2l-button>
147
+ <d2l-button slot="footer" data-dialog-action="deny">No</d2l-button>
148
+ </d2l-dialog>
149
+ </div>
150
+ <d2l-button slot="footer" primary data-dialog-action="ok">Close Me!</d2l-button>
151
+ <d2l-button slot="footer" data-dialog-action="close">Close without confirmation</d2l-button>
152
+ <d2l-button slot="footer" data-dialog-action="cancel">Cancel</d2l-button>
153
+ </d2l-dialog>
154
+ <script>
155
+ let canBeClosed = false;
156
+ document.querySelector('#openInterceptClosing').addEventListener('click', () => {
157
+ document.querySelector('#dialogInterceptClosing').opened = true;
158
+ });
159
+ document.querySelector('#dialogInterceptClosing').addEventListener('d2l-dialog-open', () => {
160
+ canBeClosed = false;
161
+ });
162
+ document.querySelector('#dialogInterceptClosing').addEventListener('d2l-dialog-close', (e) => {
163
+ console.log('dialog action:', e.detail.action);
164
+ });
165
+ document.querySelector('#dialogConfirmClose').addEventListener('d2l-dialog-close', (e) => {
166
+ e.stopPropagation();
167
+ });
168
+ document.querySelector('#dialogInterceptClosing').addEventListener('d2l-dialog-before-close', async(e) => {
169
+
170
+ if (e.detail.action === 'close' || canBeClosed) return;
171
+
172
+ e.preventDefault();
173
+ const action = await document.querySelector('#dialogConfirmClose').open();
174
+
175
+ console.log('dialog action:', e.detail.action, ', confirm dialog action:', action);
176
+ if (action === 'confirm') {
177
+ canBeClosed = true;
178
+ e.detail.closeDialog();
179
+ }
180
+ });
181
+ </script>
182
+ </template>
183
+ </d2l-demo-snippet>
184
+
107
185
  </d2l-demo-page>
108
186
  </body>
109
187
  </html>
@@ -74,16 +74,24 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
74
74
 
75
75
  dialog.d2l-dialog-outer,
76
76
  div.d2l-dialog-outer {
77
+ animation: d2l-dialog-fullscreen-close 200ms ease-out;
77
78
  border-radius: 8px;
78
79
  margin: 1.5rem;
79
80
  max-width: 1170px;
80
- opacity: 0;
81
81
  top: 0;
82
- transform: translateY(-50px) scale(0.97);
83
- transition: transform 200ms ease-out, opacity 200ms ease-out;
84
82
  width: auto;
85
83
  }
86
84
 
85
+ @keyframes d2l-dialog-fullscreen-close {
86
+ 0% { opacity: 1; transform: translateY(0); }
87
+ 100% { opacity: 0; transform: translateY(-50px) scale(0.97); }
88
+ }
89
+
90
+ @keyframes d2l-dialog-fullscreen-open {
91
+ 0% { opacity: 0; transform: translateY(-50px) scale(0.97); }
92
+ 100% { opacity: 1; transform: translateY(0); }
93
+ }
94
+
87
95
  dialog.d2l-dialog-outer.d2l-dialog-fullscreen-within,
88
96
  div.d2l-dialog-outer.d2l-dialog-fullscreen-within {
89
97
  /* no margins when there is a fullscreen element within */
@@ -107,8 +115,7 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
107
115
 
108
116
  :host([_state="showing"]) dialog.d2l-dialog-outer,
109
117
  :host([_state="showing"]) div.d2l-dialog-outer {
110
- opacity: 1;
111
- transition-duration: 400ms;
118
+ animation: d2l-dialog-fullscreen-open 400ms ease-out;
112
119
  }
113
120
 
114
121
  dialog::backdrop {
@@ -128,8 +135,10 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
128
135
  @media (prefers-reduced-motion: reduce) {
129
136
 
130
137
  dialog.d2l-dialog-outer,
131
- div.d2l-dialog-outer {
132
- transition: none;
138
+ div.d2l-dialog-outer,
139
+ :host([_state="showing"]) dialog.d2l-dialog-outer,
140
+ :host([_state="showing"]) div.d2l-dialog-outer {
141
+ animation: none;
133
142
  }
134
143
 
135
144
  dialog::backdrop {
@@ -161,10 +170,6 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
161
170
  height: calc(100% - 1px);
162
171
  }
163
172
 
164
- div[nested].d2l-dialog-outer {
165
- top: 0;
166
- }
167
-
168
173
  :host([dir="rtl"]) .d2l-dialog-header > div > d2l-button-icon {
169
174
  margin-left: -13px;
170
175
  margin-right: 15px;
@@ -144,6 +144,11 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
144
144
  clearDismissible(this._dismissibleId);
145
145
  this._dismissibleId = null;
146
146
 
147
+ if (this._isCloseAborted()) {
148
+ this._dismissibleId = setDismissible(() => this._close(abortAction));
149
+ return;
150
+ }
151
+
147
152
  if (!this.shadowRoot) return;
148
153
  const dialog = this.shadowRoot.querySelector('.d2l-dialog-outer');
149
154
 
@@ -154,11 +159,11 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
154
159
 
155
160
  this._scroll = false;
156
161
  if (!reduceMotion) {
157
- const transitionEnd = () => {
158
- dialog.removeEventListener('transitionend', transitionEnd);
162
+ const animationEnd = () => {
163
+ dialog.removeEventListener('animationend', animationEnd);
159
164
  doClose();
160
165
  };
161
- dialog.addEventListener('transitionend', transitionEnd);
166
+ dialog.addEventListener('animationend', animationEnd);
162
167
  this._state = 'hiding';
163
168
  } else {
164
169
  this._state = 'hiding';
@@ -298,6 +303,21 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
298
303
  this._useNative = false;
299
304
  }
300
305
 
306
+ _isCloseAborted() {
307
+
308
+ /** Dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing */
309
+ const abortEvent = new CustomEvent('d2l-dialog-before-close', {
310
+ cancelable: true,
311
+ detail: {
312
+ action: this._action,
313
+ closeDialog: this._close.bind(this, this._action)
314
+ }
315
+ });
316
+ this.dispatchEvent(abortEvent);
317
+
318
+ return abortEvent.defaultPrevented;
319
+ }
320
+
301
321
  _open() {
302
322
  if (!this.opened) return;
303
323
 
@@ -314,11 +334,11 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
314
334
  const dialog = this.shadowRoot.querySelector('.d2l-dialog-outer');
315
335
 
316
336
  const animPromise = new Promise((resolve) => {
317
- const transitionEnd = () => {
318
- dialog.removeEventListener('transitionend', transitionEnd);
337
+ const animationEnd = () => {
338
+ dialog.removeEventListener('animationend', animationEnd);
319
339
  resolve();
320
340
  };
321
- dialog.addEventListener('transitionend', transitionEnd);
341
+ dialog.addEventListener('animationend', animationEnd);
322
342
  });
323
343
 
324
344
  if (this._useNative) {
@@ -21,6 +21,7 @@ export const dialogStyles = css`
21
21
  }
22
22
 
23
23
  .d2l-dialog-outer {
24
+ animation: d2l-dialog-close 200ms ease-in;
24
25
  background-color: white;
25
26
  border: 1px solid var(--d2l-color-mica);
26
27
  border-radius: 8px;
@@ -28,8 +29,21 @@ export const dialogStyles = css`
28
29
  box-sizing: content-box;
29
30
  position: fixed; /* also required for native to override position: absolute */
30
31
  top: 100px;
31
- transform: translateY(-50px);
32
- transition: transform 200ms ease-in;
32
+ }
33
+
34
+ :host([_state="showing"]) > .d2l-dialog-outer {
35
+ /* must target direct child to avoid ancestor from interfering with closing child dialogs in Legacy-Edge */
36
+ animation: d2l-dialog-open 200ms ease-in;
37
+ }
38
+
39
+ @keyframes d2l-dialog-close {
40
+ 0% { transform: translateY(0); }
41
+ 100% { transform: translateY(-50px); }
42
+ }
43
+
44
+ @keyframes d2l-dialog-open {
45
+ 0% { transform: translateY(-50px); }
46
+ 100% { transform: translateY(0); }
33
47
  }
34
48
 
35
49
  .d2l-dialog-outer.d2l-dialog-outer-nested-showing {
@@ -45,10 +59,6 @@ export const dialogStyles = css`
45
59
  z-index: 1000;
46
60
  }
47
61
 
48
- .d2l-dialog-outer.d2l-dialog-outer-nested {
49
- top: 0;
50
- }
51
-
52
62
  dialog.d2l-dialog-outer {
53
63
  color: var(--d2l-color-ferrite);
54
64
  margin-bottom: 0; /* required to override Chrome native positioning */
@@ -63,11 +73,6 @@ export const dialogStyles = css`
63
73
  transition: opacity 200ms ease-in;
64
74
  }
65
75
 
66
- :host([_state="showing"]) > .d2l-dialog-outer {
67
- /* must target direct child to avoid ancestor from interfering with closing child dialogs in Legacy-Edge */
68
- transform: translateY(0);
69
- }
70
-
71
76
  :host([_state="showing"]) dialog::backdrop {
72
77
  opacity: 0.7;
73
78
  }
@@ -158,8 +163,9 @@ export const dialogStyles = css`
158
163
  }
159
164
 
160
165
  @media (prefers-reduced-motion: reduce) {
161
- .d2l-dialog-outer {
162
- transition: none;
166
+ .d2l-dialog-outer,
167
+ :host([_state="showing"]) > .d2l-dialog-outer {
168
+ animation: none;
163
169
  }
164
170
  dialog::backdrop {
165
171
  transition: none;
@@ -80,10 +80,6 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
80
80
  top: 42px;
81
81
  }
82
82
 
83
- div[nested].d2l-dialog-outer {
84
- top: 0;
85
- }
86
-
87
83
  .d2l-dialog-header > div > d2l-button-icon {
88
84
  margin: -8px -13px 0 15px;
89
85
  }
@@ -68,7 +68,7 @@ To use `d2l-html-block` within another Lit component, use the [unsafeHTML](https
68
68
 
69
69
  ### Rendering MathML and LaTeX
70
70
 
71
- Examples are provided to display how user-authored math can be embedded within your webpage.
71
+ Examples are provided to display how user-authored math can be embedded within your webpage. Note that rendering math requires the `mathjax` context to be set correctly. For testing and/or demo pages **ONLY**, you can import `@brightspace-ui/core/tools/mathjax-test-context.js` to set this context for you.
72
72
 
73
73
  **MathML:**
74
74
  <!-- docs: demo code -->
@@ -76,6 +76,7 @@ Examples are provided to display how user-authored math can be embedded within y
76
76
  <script type="module">
77
77
  import '@brightspace-ui/core/components/html-block/html-block.js';
78
78
  import '@brightspace-ui/core/components/icons/icon.js';
79
+ import '@brightspace-ui/core/tools/mathjax-test-context.js';
79
80
  </script>
80
81
  <d2l-html-block>
81
82
  <div class="mathml-container">
@@ -100,7 +101,7 @@ Examples are provided to display how user-authored math can be embedded within y
100
101
  </d2l-html-block>
101
102
  ```
102
103
 
103
- **LaTeX:** Rendering LaTeX requires the `mathjax` context to be set correctly. For testing and/or demo pages you can do the following.
104
+ **LaTeX:**
104
105
 
105
106
  <!-- docs: demo code -->
106
107
  ```html
@@ -11,6 +11,12 @@ export const htmlBlockContentStyles = css`
11
11
  font-weight: 400;
12
12
  line-height: 1.2rem;
13
13
  }
14
+ .d2l-html-block-rendered > :first-child {
15
+ margin-top: 0;
16
+ }
17
+ .d2l-html-block-rendered > :last-child {
18
+ margin-bottom: 0;
19
+ }
14
20
  h1, h2, h3, h4, h5, h6, b, strong, b *, strong * {
15
21
  font-weight: bold;
16
22
  }
@@ -194,7 +200,11 @@ class HtmlBlock extends RtlMixin(LitElement) {
194
200
  super.firstUpdated(changedProperties);
195
201
 
196
202
  if (this._renderContainer) return;
197
- this.shadowRoot.innerHTML += `<div class="d2l-html-block-rendered${this.compact ? ' d2l-html-block-compact' : ''}"></div><slot ${!this.noDeferredRendering ? 'style="display: none"' : ''}></slot>`;
203
+ this.shadowRoot.innerHTML += '<div class="d2l-html-block-rendered'
204
+ + `${this.compact ? ' d2l-html-block-compact' : ''}`
205
+ + '"></div><slot'
206
+ + `${!this.noDeferredRendering ? ' style="display: none"' : ''}`
207
+ + '></slot>';
198
208
 
199
209
  this.shadowRoot.querySelector('slot').addEventListener('slotchange', async e => await this._render(e.target));
200
210
  this._renderContainer = this.shadowRoot.querySelector('.d2l-html-block-rendered');
@@ -33,6 +33,13 @@
33
33
  </template>
34
34
  </d2l-demo-snippet>
35
35
 
36
+ <h2>Custom Interval (Issue #1751)</h2>
37
+ <d2l-demo-snippet>
38
+ <template>
39
+ <d2l-input-time-range label="Time Range" start-value="15:15" time-interval="ten" enforce-time-intervals></d2l-input-time-range>
40
+ </template>
41
+ </d2l-demo-snippet>
42
+
36
43
  <h2>Hidden Label</h2>
37
44
  <d2l-demo-snippet>
38
45
  <template>
@@ -1,5 +1,5 @@
1
1
  # Tag List
2
- *This component is in progress. The API is generally stable but the ability to clear tags is currently a WIP.*
2
+ *This component is in progress. The API is generally stable but there could be some appearance or minor behavior churn in the short-term.*
3
3
 
4
4
  Tag lists are used to present a list of compact, discrete pieces of information.
5
5
 
@@ -31,8 +31,12 @@ The `d2l-tag-list` element can take a combination of any type of `d2l-tag-list-i
31
31
  <script type="module">
32
32
  import '@brightspace-ui/core/components/tag-list/tag-list.js';
33
33
  import '@brightspace-ui/core/components/tag-list/tag-list-item.js';
34
- </script>
35
34
 
35
+ document.addEventListener('d2l-tag-list-item-clear', (e) => {
36
+ e.target.parentNode.removeChild(e.target);
37
+ console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}, handleFocus: ${e.detail.handleFocus}`);
38
+ });
39
+ </script>
36
40
  <d2l-tag-list description="Example Tags">
37
41
  <d2l-tag-list-item text="Lorem ipsum dolor"></d2l-tag-list-item>
38
42
  <d2l-tag-list-item text="Reprehenderit in voluptate velit esse"></d2l-tag-list-item>
@@ -49,6 +53,11 @@ The `d2l-tag-list-item` provides the appropriate `listitem` semantics and stylin
49
53
  <script type="module">
50
54
  import '@brightspace-ui/core/components/tag-list/tag-list.js';
51
55
  import '@brightspace-ui/core/components/tag-list/tag-list-item.js';
56
+
57
+ document.addEventListener('d2l-tag-list-item-clear', (e) => {
58
+ e.target.parentNode.removeChild(e.target);
59
+ console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}, handleFocus: ${e.detail.handleFocus}`);
60
+ });
52
61
  </script>
53
62
 
54
63
  <d2l-tag-list description="Example Tags">
@@ -64,9 +64,9 @@
64
64
  <d2l-tag-list-item text="Example Tag 7"></d2l-tag-list-item>
65
65
  </d2l-tag-list>
66
66
  <script>
67
- document.addEventListener('d2l-tag-list-item-cleared', (e) => {
67
+ document.addEventListener('d2l-tag-list-item-clear', (e) => {
68
68
  e.target.parentNode.removeChild(e.target);
69
- console.log(`d2l-tag-list-item-cleared event dispatched. Value: ${e.detail.value}, handleFocus: ${e.detail.handleFocus}`);
69
+ console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}, handleFocus: ${e.detail.handleFocus}`);
70
70
  });
71
71
  </script>
72
72
  </d2l-demo-snippet>
@@ -15,7 +15,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
15
15
  static get properties() {
16
16
  return {
17
17
  /**
18
- * Enables the option to clear a tag list item. The `d2l-tag-list-item-cleared` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.
18
+ * Enables the option to clear a tag list item. The `d2l-tag-list-item-clear` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.
19
19
  */
20
20
  clearable: { type: Boolean },
21
21
  /**
@@ -136,7 +136,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
136
136
 
137
137
  /** Dispatched when a user selects to delete a tag list item. The consumer must handle the actual element deletion and focus behaviour if there are no remaining list items. */
138
138
  this.dispatchEvent(new CustomEvent(
139
- 'd2l-tag-list-item-cleared',
139
+ 'd2l-tag-list-item-clear',
140
140
  { bubbles: true, composed: true, detail: { value: this.text, handleFocus } }
141
141
  ));
142
142
  }