@brightspace-ui/core 3.135.2 → 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}
@@ -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.2",
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",