@brightspace-ui/core 2.13.0 → 2.13.3

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.
@@ -7,6 +7,7 @@ import { heading3Styles } from '../typography/styles.js';
7
7
 
8
8
  /**
9
9
  * A simple confirmation dialog for prompting the user. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the confirm dialog with the action value.
10
+ * @fires 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
10
11
  * @slot footer - Slot for footer content such as workflow buttons
11
12
  */
12
13
  class DialogConfirm extends DialogMixin(LitElement) {
@@ -14,6 +14,7 @@ const mediaQueryList = window.matchMedia('(max-width: 615px), (max-height: 420px
14
14
 
15
15
  /**
16
16
  * A generic fullscreen dialog that provides a slot for arbitrary content and a "footer" slot for workflow buttons. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the dialog with the action value.
17
+ * @fires 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
17
18
  * @slot - Default slot for content inside dialog
18
19
  * @slot footer - Slot for footer content such as workflow buttons
19
20
  */
@@ -304,8 +304,6 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
304
304
  }
305
305
 
306
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
307
  const abortEvent = new CustomEvent('d2l-dialog-before-close', {
310
308
  cancelable: true,
311
309
  detail: {
@@ -16,6 +16,7 @@ const mediaQueryList = window.matchMedia('(max-width: 615px), (max-height: 420px
16
16
 
17
17
  /**
18
18
  * A generic dialog that provides a slot for arbitrary content and a "footer" slot for workflow buttons. Apply the "data-dialog-action" attribute to workflow buttons to automatically close the dialog with the action value.
19
+ * @fires 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
19
20
  * @slot - Default slot for content inside dialog
20
21
  * @slot footer - Slot for footer content such as workflow buttons
21
22
  */
@@ -110,6 +110,38 @@
110
110
  </template>
111
111
  </d2l-demo-snippet>
112
112
 
113
+ <h2>HTML Block (large font)</h2>
114
+
115
+ <d2l-demo-snippet>
116
+ <template>
117
+ <d2l-html-block>
118
+ <div style="font-size: 42px;">
119
+ Just a text node...
120
+ <h1>heading 1</h1>
121
+ <h2>heading 2</h2>
122
+ <h3>heading 3</h3>
123
+ <h4>heading 4</h4>
124
+ <h5>heading 5</h5>
125
+ <h6>heading 6</h6>
126
+ <div><strong>strong</strong></div>
127
+ <div><b>bold</b></div>
128
+ <div>text</div>
129
+ <pre>preformatted</pre>
130
+ <p>paragraph</p>
131
+ <ul>
132
+ <li>unordered item 1</li>
133
+ <li>unordered item 2</li>
134
+ </ul>
135
+ <ol>
136
+ <li>ordered item 1</li>
137
+ <li>ordered item 2</li>
138
+ </ol>
139
+ <div><a href="https://d2l.com">anchor</a></div>
140
+ </div>
141
+ </d2l-html-block>
142
+ </template>
143
+ </d2l-demo-snippet>
144
+
113
145
  <h2>HTML Block (math)</h2>
114
146
 
115
147
  <d2l-demo-snippet>
@@ -9,7 +9,10 @@ export const htmlBlockContentStyles = css`
9
9
  .d2l-html-block-compact {
10
10
  font-size: 0.8rem;
11
11
  font-weight: 400;
12
- line-height: 1.2rem;
12
+ line-height: 1.5; /* 1.2rem / 0.8rem */
13
+ }
14
+ .d2l-html-block-rendered {
15
+ line-height: 1.47; /* 1.4rem / 0.95rem */
13
16
  }
14
17
  .d2l-html-block-rendered > :first-child {
15
18
  margin-top: 0;
@@ -22,33 +25,33 @@ export const htmlBlockContentStyles = css`
22
25
  }
23
26
  h1 {
24
27
  font-size: 2em;
25
- line-height: 37px;
26
- margin: 21.43px 0;
28
+ line-height: 1;
29
+ margin: 21px 0;
27
30
  }
28
31
  h2 {
29
32
  font-size: 1.5em;
30
- line-height: 27px;
31
- margin: 19.92px 0;
33
+ line-height: 1;
34
+ margin: 20px 0;
32
35
  }
33
36
  h3 {
34
37
  font-size: 1.2em;
35
- line-height: 23px;
36
- margin: 18.72px 0;
38
+ line-height: 1;
39
+ margin: 19px 0;
37
40
  }
38
41
  h4 {
39
42
  font-size: 1em;
40
- line-height: 20px;
41
- margin: 21.28px 0;
43
+ line-height: 1.05;
44
+ margin: 21px 0;
42
45
  }
43
46
  h5 {
44
47
  font-size: 0.83em;
45
- line-height: 16px;
46
- margin: 22.13px 0;
48
+ line-height: 1;
49
+ margin: 22px 0;
47
50
  }
48
51
  h6 {
49
52
  font-size: 0.67em;
50
- line-height: 13px;
51
- margin: 24.97px 0;
53
+ line-height: 1;
54
+ margin: 25px 0;
52
55
  }
53
56
  pre {
54
57
  font-family: Monospace;
@@ -41,6 +41,7 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
41
41
  */
42
42
  description: { type: String },
43
43
  _chompIndex: { type: Number },
44
+ _contentReady: { type: Boolean },
44
45
  _lines: { type: Number },
45
46
  _showHiddenTags: { type: Boolean }
46
47
  };
@@ -68,11 +69,16 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
68
69
  visibility: hidden;
69
70
  }
70
71
  .d2l-tag-list-clear-button {
72
+ position: absolute;
71
73
  visibility: hidden;
72
74
  }
73
75
  .d2l-tag-list-clear-button.d2l-tag-list-clear-button-visible {
76
+ position: static;
74
77
  visibility: visible;
75
78
  }
79
+ .tag-list-hidden {
80
+ visibility: hidden;
81
+ }
76
82
  `;
77
83
  }
78
84
 
@@ -82,8 +88,11 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
82
88
  this.arrowKeysDirection = 'leftrightupdown';
83
89
  this.clearable = false;
84
90
  this._chompIndex = 10000;
91
+ this._clearButtonHeight = 0;
85
92
  this._clearButtonWidth = 0;
93
+ this._contentReady = false;
86
94
  this._hasResized = false;
95
+ this._itemHeight = 0;
87
96
  this._resizeObserver = null;
88
97
  this._showHiddenTags = false;
89
98
  }
@@ -111,6 +120,7 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
111
120
  const clearButton = this.shadowRoot.querySelector('d2l-button-subtle.d2l-tag-list-clear-button');
112
121
  this._clearButtonResizeObserver = new ResizeObserver(() => {
113
122
  this._clearButtonWidth = Math.ceil(parseFloat(getComputedStyle(clearButton).getPropertyValue('width')));
123
+ this._clearButtonHeight = Math.ceil(parseFloat(getComputedStyle(clearButton).getPropertyValue('height')));
114
124
  });
115
125
  this._clearButtonResizeObserver.observe(clearButton);
116
126
  }
@@ -154,8 +164,13 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
154
164
  'd2l-tag-list-clear-button-visible': this.clearable && this._items && this._items.length > 0
155
165
  };
156
166
 
167
+ const containerClasses = {
168
+ 'tag-list-container': true,
169
+ 'tag-list-hidden': !this._contentReady
170
+ };
171
+
157
172
  const list = html`
158
- <div role="list" class="tag-list-container" aria-label="${this.description}" @d2l-tag-list-item-clear="${this._handleItemDeleted}">
173
+ <div role="list" class="${classMap(containerClasses)}" aria-label="${this.description}" @d2l-tag-list-item-clear="${this._handleItemDeleted}">
159
174
  <slot @slotchange="${this._handleSlotChange}"></slot>
160
175
  ${overflowButton}
161
176
  <d2l-button-subtle
@@ -169,7 +184,8 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
169
184
  `;
170
185
 
171
186
  const outerContainerStyles = {
172
- maxHeight: (this._showHiddenTags || !this._lines) ? undefined : `${(this._itemHeight + MARGIN_TOP_RIGHT) * this._lines}px`
187
+ maxHeight: (this._showHiddenTags || !this._lines) ? undefined : `${(this._itemHeight + MARGIN_TOP_RIGHT) * this._lines}px`,
188
+ minHeight: `${Math.max(this._clearButtonHeight, this._itemHeight)}px`
173
189
  };
174
190
 
175
191
  return html`
@@ -314,37 +330,37 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
314
330
  }
315
331
  }
316
332
 
317
- _handleResize(entries) {
333
+ async _handleResize(entries) {
318
334
  this._availableWidth = Math.floor(entries[0].contentRect.width);
319
335
  if (this._availableWidth >= PAGE_SIZE.large) this._lines = PAGE_SIZE_LINES.large;
320
336
  else if (this._availableWidth < PAGE_SIZE.large && this._availableWidth >= PAGE_SIZE.medium) this._lines = PAGE_SIZE_LINES.medium;
321
337
  else this._lines = PAGE_SIZE_LINES.small;
322
338
  if (!this._hasResized) {
323
339
  this._hasResized = true;
324
- this._handleSlotChange();
340
+ await this._handleSlotChange();
325
341
  } else {
326
342
  this._chomp();
327
343
  }
328
344
  }
329
345
 
330
- _handleSlotChange() {
346
+ async _handleSlotChange() {
331
347
  if (!this._hasResized) return;
348
+ this._contentReady = false;
349
+ await this.updateComplete;
332
350
 
333
- setTimeout(async() => {
334
- this._items = await this._getTagListItems();
335
- if (!this._items || this._items.length === 0) {
336
- this._chompIndex = 10000;
337
- return;
338
- }
351
+ this._items = await this._getTagListItems();
352
+ if (!this._items || this._items.length === 0) {
353
+ this._chompIndex = 10000;
354
+ return;
355
+ }
339
356
 
340
- this._itemLayouts = this._getItemLayouts(this._items);
341
- this._itemHeight = this._items[0].offsetHeight;
342
- this._items.forEach((item, index) => {
343
- item.setAttribute('tabIndex', index === 0 ? 0 : -1);
344
- });
345
- this._chomp();
346
- this.requestUpdate();
347
- }, 40);
357
+ this._itemLayouts = this._getItemLayouts(this._items);
358
+ this._itemHeight = this._items[0].offsetHeight;
359
+ this._items.forEach((item, index) => {
360
+ item.setAttribute('tabIndex', index === 0 ? 0 : -1);
361
+ });
362
+ this._chomp();
363
+ this._contentReady = true;
348
364
  }
349
365
 
350
366
  async _toggleHiddenTagVisibility(e) {
@@ -1522,11 +1522,12 @@
1522
1522
  ],
1523
1523
  "events": [
1524
1524
  {
1525
- "name": "d2l-dialog-close",
1526
- "description": "Dispatched with the action value when the dialog is closed for any reason"
1525
+ "name": "d2l-dialog-before-close",
1526
+ "description": "Dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing"
1527
1527
  },
1528
1528
  {
1529
- "name": "d2l-dialog-before-close"
1529
+ "name": "d2l-dialog-close",
1530
+ "description": "Dispatched with the action value when the dialog is closed for any reason"
1530
1531
  },
1531
1532
  {
1532
1533
  "name": "d2l-dialog-open",
@@ -1596,11 +1597,12 @@
1596
1597
  ],
1597
1598
  "events": [
1598
1599
  {
1599
- "name": "d2l-dialog-close",
1600
- "description": "Dispatched with the action value when the dialog is closed for any reason"
1600
+ "name": "d2l-dialog-before-close",
1601
+ "description": "Dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing"
1601
1602
  },
1602
1603
  {
1603
- "name": "d2l-dialog-before-close"
1604
+ "name": "d2l-dialog-close",
1605
+ "description": "Dispatched with the action value when the dialog is closed for any reason"
1604
1606
  },
1605
1607
  {
1606
1608
  "name": "d2l-dialog-open",
@@ -1700,11 +1702,12 @@
1700
1702
  ],
1701
1703
  "events": [
1702
1704
  {
1703
- "name": "d2l-dialog-close",
1704
- "description": "Dispatched with the action value when the dialog is closed for any reason"
1705
+ "name": "d2l-dialog-before-close",
1706
+ "description": "Dispatched with the action value before the dialog is closed for any reason, providing an opportunity to prevent the dialog from closing"
1705
1707
  },
1706
1708
  {
1707
- "name": "d2l-dialog-before-close"
1709
+ "name": "d2l-dialog-close",
1710
+ "description": "Dispatched with the action value when the dialog is closed for any reason"
1708
1711
  },
1709
1712
  {
1710
1713
  "name": "d2l-dialog-open",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.13.0",
3
+ "version": "2.13.3",
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",