@brightspace-ui/core 3.135.1 → 3.135.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.
@@ -369,10 +369,10 @@ class InputTime extends InputInlineHelpMixin(FocusMixin(LabelledMixin(SkeletonMi
369
369
  min-width="195"
370
370
  ?opened="${opened}">
371
371
  <d2l-menu
372
- aria-labelledby="${this._dropdownId}-label"
373
372
  class="d2l-input-time-menu"
374
373
  @d2l-menu-item-change="${this._handleDropdownChange}"
375
374
  id="${this._dropdownId}"
375
+ label="${this.label}"
376
376
  role="listbox"
377
377
  root-view>
378
378
  ${menuItems}
@@ -26,6 +26,14 @@ A loading spinner indicates that something is happening and we don't know how lo
26
26
  <!-- docs: end donts -->
27
27
  <!-- docs: end best practices -->
28
28
 
29
+ ### When should I use the Skeleton Loader pattern vs. a Loading Spinner?
30
+ The skeleton loader pattern has a feeling of "an existing structure coming into focus", whereas the spinner has a feeling of progression. Because of this, we say that Skeleton Loaders are for loading page chrome, whereas Spinners are for loading data.
31
+ * If the page is loading for the first time and different parts of the page are coming in asynchronously, use Skeleton Loader pattern.
32
+ * If your design is progressively disclosing new components (new form fields for example) because the user has expanded or opened a panel, use Skeleton Loader pattern.
33
+ * If the data on a page changes as a result of a user action, ie: sorting or filtering a table, paginating, etc -- use a Loading Spinner.
34
+ * If you need to communicate that part of the page is processing data, use a spinner.
35
+ * If the whole page is about to refresh (ie: the user has pressed submit on a form), you do NOT need to show a loading spinner ... the browser's native "loading" affordances are enough.
36
+
29
37
  ## Loading Spinner [d2l-loading-spinner]
30
38
 
31
39
  <!-- docs: demo code properties name:d2l-loading-spinner sandboxTitle:'Loading Spinner' -->
@@ -7,8 +7,7 @@ class CustomView extends HierarchicalViewMixin(LitElement) {
7
7
  return [ super.styles,
8
8
  css`
9
9
  :host {
10
- background-image: url("https://www.nasa.gov/sites/default/files/images/504349main_ngc6357_hst_big_full.jpg");
11
- background-size: cover;
10
+ background-color: black;
12
11
  border: 1px solid black;
13
12
  border-radius: 0.3rem;
14
13
  box-sizing: border-box;
@@ -262,7 +262,11 @@ class Menu extends PropertyRequiredMixin(ThemeMixin(HierarchicalViewMixin(LitEle
262
262
  }
263
263
 
264
264
  _labelChanged() {
265
- this.setAttribute('aria-label', this.label);
265
+ if (typeof this.label === 'string' && this.label.trim().length > 0) {
266
+ this.setAttribute('aria-label', this.label);
267
+ } else {
268
+ this.removeAttribute('aria-label');
269
+ }
266
270
  const returnItem = this._getMenuItemReturn();
267
271
  if (returnItem) returnItem.setAttribute('text', this.label);
268
272
  }
@@ -54,7 +54,8 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
54
54
  type: String
55
55
  },
56
56
  _hasDropdownItems: { state: true },
57
- _selectedMenuItemText: { state: true }
57
+ _selectedMenuItemText: { state: true },
58
+ _label: { state: true },
58
59
  };
59
60
  }
60
61
 
@@ -142,6 +143,7 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
142
143
  this._describedById = getUniqueId();
143
144
  this._describedBySortedId = getUniqueId();
144
145
  this._hasDropdownItems = false;
146
+ this._label = '';
145
147
  }
146
148
 
147
149
  static get focusElementSelector() {
@@ -181,13 +183,13 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
181
183
  class="${classMap({ 'd2l-dropdown-opener': this._hasDropdownItems })}"
182
184
  title="${ifDefined(buttonTitle)}"
183
185
  type="button">
184
- <slot></slot>${iconView}
186
+ <slot @slotchange="${this.#handleDefaultSlotChange}"></slot>${iconView}
185
187
  </button><span id="${this._describedById}" hidden>${buttonDescription}</span>${sortedView}`;
186
188
  if (this._hasDropdownItems) {
187
189
  return html`<d2l-dropdown>
188
190
  ${button}
189
191
  <d2l-dropdown-menu no-pointer align="start" vertical-offset="4">
190
- <d2l-menu @d2l-table-col-sort-button-item-change="${this._handleTablColSortButtonItemChange}">
192
+ <d2l-menu label="${ifDefined(this._label)}" @d2l-table-col-sort-button-item-change="${this._handleTablColSortButtonItemChange}">
191
193
  <slot name="items" @slotchange="${this._handleSlotChange}"></slot>
192
194
  </d2l-menu>
193
195
  </d2l-dropdown-menu>
@@ -219,6 +221,16 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
219
221
  this._selectedMenuItemText = e.target?.text;
220
222
  }
221
223
 
224
+ #handleDefaultSlotChange(e) {
225
+ const labels = e.target?.assignedNodes({ flatten: false })
226
+ .map(node => {
227
+ if (node.nodeType === Node.TEXT_NODE) return node.textContent;
228
+ if (node.nodeType === Node.ELEMENT_NODE) return node.innerText;
229
+ }).filter(text => typeof(text) === 'string' && text.trim().length > 0)
230
+ .map(text => text.replace(/[\t\n\r]+/g, ' ').trim());
231
+ this._label = labels.join(' ');
232
+ }
233
+
222
234
  }
223
235
 
224
236
  customElements.define('d2l-table-col-sort-button', TableColSortButton);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.135.1",
3
+ "version": "3.135.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",