@brightspace-ui/core 2.38.0 → 2.38.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.
@@ -4,10 +4,7 @@ import { css } from 'lit';
4
4
  export const emptyStateStyles = css`
5
5
 
6
6
  :host {
7
- border: 1px solid var(--d2l-color-mica);
8
- border-radius: 0.3rem;
9
7
  display: block;
10
- padding: 1.2rem 1.5rem;
11
8
  }
12
9
 
13
10
  :host([hidden]) {
@@ -27,6 +24,12 @@ export const emptyStateStyles = css`
27
24
 
28
25
  export const emptyStateSimpleStyles = css`
29
26
 
27
+ :host {
28
+ border: 1px solid var(--d2l-color-mica);
29
+ border-radius: 0.3rem;
30
+ padding: 1.2rem 1.5rem;
31
+ }
32
+
30
33
  :host([dir="rtl"]) .d2l-empty-state-description {
31
34
  padding-left: 0.5rem;
32
35
  padding-right: 0;
@@ -130,19 +130,19 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
130
130
 
131
131
  const clearButton = this.shadowRoot.querySelector('d2l-button-subtle.d2l-tag-list-clear-button');
132
132
  this._clearButtonResizeObserver = new ResizeObserver(() => {
133
- this._clearButtonWidth = Math.ceil(parseFloat(getComputedStyle(clearButton).getPropertyValue('width')));
133
+ this._clearButtonWidth = parseFloat(getComputedStyle(clearButton).getPropertyValue('width'));
134
134
  this._clearButtonHeight = Math.ceil(parseFloat(getComputedStyle(clearButton).getPropertyValue('height')));
135
135
  });
136
136
  this._clearButtonResizeObserver.observe(clearButton);
137
137
 
138
138
  let container = getOffsetParent(this);
139
- if (!container || container.tagName === 'BODY') container = this.shadowRoot.querySelector('.tag-list-outer-container');
139
+ if (!container) container = this.shadowRoot.querySelector('.tag-list-outer-container');
140
140
  this._resizeObserver = new ResizeObserver((e) => requestAnimationFrame(() => this._handleResize(e)));
141
141
  this._resizeObserver.observe(container);
142
142
 
143
- const listContainer = this.shadowRoot.querySelector('.tag-list-container');
143
+ this._listContainer = this.shadowRoot.querySelector('.tag-list-container');
144
144
  this._listContainerObserver = new ResizeObserver(() => requestAnimationFrame(() => this._handleSlotChange()));
145
- this._listContainerObserver.observe(listContainer);
145
+ this._listContainerObserver.observe(this._listContainer);
146
146
  }
147
147
 
148
148
  render() {
@@ -248,6 +248,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
248
248
  */
249
249
  let isOverflowing = false;
250
250
  let overflowingIndex = 0;
251
+
251
252
  for (let k = 1; k <= this._lines; k++) {
252
253
  showing.width = 0;
253
254
 
@@ -269,7 +270,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
269
270
  }
270
271
  }
271
272
 
272
- if (!isOverflowing && !this.clearable) {
273
+ if (!isOverflowing && (!this.clearable || this._items.length < CLEAR_ALL_THRESHOLD)) {
273
274
  this._chompIndex = showing.count;
274
275
  return;
275
276
  }
@@ -297,7 +298,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
297
298
 
298
299
  return {
299
300
  isHidden: computedStyles.display === 'none',
300
- width: Math.ceil(parseFloat(computedStyles.width) || 0)
301
+ width: parseFloat(computedStyles.width) || 0
301
302
  };
302
303
  });
303
304
 
@@ -369,8 +370,12 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
369
370
  this._hasShownKeyboardTooltip = true;
370
371
  }
371
372
 
372
- async _handleResize(entries) {
373
- this._availableWidth = Math.floor(entries[0].contentRect.width);
373
+ async _handleResize() {
374
+ this._contentReady = false;
375
+ this._chompIndex = 10000;
376
+ await this.updateComplete;
377
+
378
+ this._availableWidth = Math.ceil(this._listContainer.getBoundingClientRect().width);
374
379
  if (this._availableWidth >= PAGE_SIZE.large) this._lines = PAGE_SIZE_LINES.large;
375
380
  else if (this._availableWidth < PAGE_SIZE.large && this._availableWidth >= PAGE_SIZE.medium) this._lines = PAGE_SIZE_LINES.medium;
376
381
  else this._lines = PAGE_SIZE_LINES.small;
@@ -380,6 +385,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
380
385
  } else {
381
386
  this._chomp();
382
387
  }
388
+ this._contentReady = true;
383
389
  }
384
390
 
385
391
  async _handleSlotChange() {
@@ -388,17 +394,21 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
388
394
  await this.updateComplete;
389
395
 
390
396
  this._items = await this._getTagListItems();
397
+ this._chompIndex = 10000;
391
398
  if (!this._items || this._items.length === 0) {
392
- this._chompIndex = 10000;
393
399
  return;
394
400
  }
401
+ await this.updateComplete;
395
402
 
396
403
  this._itemLayouts = this._getItemLayouts(this._items);
397
404
  this._itemHeight = this._items[0].offsetHeight;
398
405
  this._items.forEach((item, index) => {
399
406
  item.setAttribute('tabIndex', index === 0 ? 0 : -1);
400
407
  });
408
+
409
+ this._availableWidth = Math.ceil(this._listContainer.getBoundingClientRect().width);
401
410
  this._chomp();
411
+
402
412
  this._contentReady = true;
403
413
  if (!this._hasShownKeyboardTooltip) this._items[0].setAttribute('keyboard-tooltip-item', 'keyboard-tooltip-item');
404
414
  }
@@ -151,7 +151,7 @@ export class IdSubscriberController {
151
151
  let registryIds = this._host[this._idPropertyName];
152
152
  if (!registryIds) return;
153
153
 
154
- registryIds = registryIds.split(' ');
154
+ registryIds = registryIds.trim().split(' ');
155
155
  registryIds.forEach(registryId => {
156
156
  this._updateRegistry(registryId, 0);
157
157
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.38.0",
3
+ "version": "2.38.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",
@@ -47,7 +47,7 @@
47
47
  "@brightspace-ui/stylelint-config": "^0.6",
48
48
  "@open-wc/testing": "^3",
49
49
  "@web/dev-server": "^0.1",
50
- "@web/test-runner": "^0.13",
50
+ "@web/test-runner": "^0.14",
51
51
  "@web/test-runner-playwright": "^0.8",
52
52
  "axe-core": "^4",
53
53
  "chalk": "^5",