@brightspace-ui/core 2.161.0 → 2.161.1

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.
@@ -136,6 +136,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
136
136
  this.keyboardTooltipShown = false;
137
137
  this._id = getUniqueId();
138
138
  this._plainText = '';
139
+ this._validatingPlainTextTimeout = null;
139
140
  }
140
141
 
141
142
  firstUpdated(changedProperties) {
@@ -216,7 +217,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
216
217
  }
217
218
 
218
219
  _renderTag(tagContent, options = {}) {
219
- if (options.plainText?.constructor !== String) throw new TypeError('options.plainText must be a string');
220
+ this._validatePlainText();
220
221
  this._plainText = options.plainText || '';
221
222
 
222
223
  const buttonText = this.localize('components.tag-list.clear', { value: this._plainText });
@@ -276,4 +277,17 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
276
277
  `;
277
278
  }
278
279
 
280
+ _validatePlainText() {
281
+ clearTimeout(this._validatingPlainTextTimeout);
282
+ // don't error immediately in case it doesn't get set immediately
283
+ this._validatingPlainTextTimeout = setTimeout(() => {
284
+ this._validatingPlainTextTimeout = null;
285
+ if (!this.isConnected) return;
286
+ const hasPlainText = (this._plainText?.constructor === String) && this._plainText?.length > 0;
287
+ if (!hasPlainText) {
288
+ throw new Error(`TagListItemMixin: "${this.tagName.toLowerCase()}" called "_render()" with empty "plainText" option`);
289
+ }
290
+ }, 3000);
291
+ }
292
+
279
293
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.161.0",
3
+ "version": "2.161.1",
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",