@brightspace-ui/core 3.135.2 → 3.135.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.
@@ -1,9 +1,8 @@
1
1
  import { css, html, LitElement } from 'lit';
2
- import { RtlMixin } from '../../../mixins/rtl/rtl-mixin.js';
3
2
  import { selectStyles } from '../input-select-styles.js';
4
3
  import { SkeletonMixin } from '../../../components/skeleton/skeleton-mixin.js';
5
4
 
6
- class TestInputSelect extends SkeletonMixin(RtlMixin(LitElement)) {
5
+ class TestInputSelect extends SkeletonMixin(LitElement) {
7
6
 
8
7
  static get properties() {
9
8
  return {
@@ -18,7 +18,7 @@ export const selectStyles = css`
18
18
  background-color: #ffffff;
19
19
  background-image: ${chevron};
20
20
  background-origin: border-box;
21
- background-position: center right 17px;
21
+ background-position: center var(--d2l-inline-end, right) 17px;
22
22
  background-repeat: no-repeat;
23
23
  background-size: 11px 7px;
24
24
  border: none;
@@ -40,9 +40,6 @@ export const selectStyles = css`
40
40
  padding-inline: calc(0.75rem + 1px) calc(2px + 0.8rem + 1px + 11px + 16px + 1px);
41
41
  vertical-align: middle;
42
42
  }
43
- :host([dir="rtl"]) .d2l-input-select {
44
- background-position: center left 17px;
45
- }
46
43
 
47
44
  .d2l-input-select:not([disabled]):hover,
48
45
  .d2l-input-select:not([disabled]):${focusClass} {
@@ -52,7 +49,7 @@ export const selectStyles = css`
52
49
  }
53
50
  .d2l-input-select[aria-invalid="true"] {
54
51
  background-image: ${chevron}, ${invalidIcon};
55
- background-position: center right 17px, center right calc(1px + 11px + 17px);
52
+ background-position: center var(--d2l-inline-end, right) 17px, center var(--d2l-inline-end, right) calc(1px + 11px + 17px);
56
53
  background-repeat: no-repeat, no-repeat;
57
54
  background-size: 11px 7px, 0.8rem 0.8rem;
58
55
  }
@@ -61,9 +58,6 @@ export const selectStyles = css`
61
58
  .d2l-input-select[aria-invalid="true"]:hover {
62
59
  outline-color: var(--d2l-color-cinnabar);
63
60
  }
64
- :host([dir="rtl"]) .d2l-input-select[aria-invalid="true"] {
65
- background-position: center left 17px, center left calc(1px + 11px + 17px);
66
- }
67
61
  .d2l-input-select:disabled {
68
62
  opacity: 0.5;
69
63
  }
@@ -95,7 +89,7 @@ export const selectStyles = css`
95
89
 
96
90
  .d2l-input-select[aria-invalid="true"] {
97
91
  background-image: ${invalidIcon};
98
- background-position: center right calc(1px + 11px + 17px);
92
+ background-position: center var(--d2l-inline-end, right) calc(1px + 11px + 17px);
99
93
  background-repeat: no-repeat;
100
94
  background-size: 0.8rem 0.8rem;
101
95
  }
@@ -105,8 +99,5 @@ export const selectStyles = css`
105
99
  .d2l-input-select[aria-invalid="true"]:hover {
106
100
  outline-color: var(--d2l-color-cinnabar);
107
101
  }
108
- :host([dir="rtl"]) .d2l-input-select[aria-invalid="true"] {
109
- background-position: center left calc(1px + 11px + 17px);
110
- }
111
102
  }
112
103
  `;
@@ -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);
@@ -506,10 +506,12 @@ export const baseTypographyStyles = css`
506
506
  html {
507
507
  --d2l-document-direction: ltr;
508
508
  --d2l-mirror-transform: none;
509
+ --d2l-inline-end: right;
509
510
  }
510
511
  html[dir="rtl"] {
511
512
  --d2l-document-direction: rtl;
512
513
  --d2l-mirror-transform: scale(-1, 1);
514
+ --d2l-inline-end: left;
513
515
  }
514
516
 
515
517
  .d2l-typography {
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.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",