@brightspace-ui/core 2.131.5 → 2.131.7

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.
@@ -51,7 +51,7 @@ class FilterTags extends LocalizeCoreElement(LitElement) {
51
51
  <d2l-tag-list-item
52
52
  @d2l-tag-list-item-clear="${this._tagListItemDeleted}"
53
53
  data-filter-id="${filter[0]}"
54
- data-index="${index}"
54
+ key="${index}"
55
55
  text="${value.text}">
56
56
  </d2l-tag-list-item>
57
57
  `;
@@ -88,8 +88,8 @@ class FilterTags extends LocalizeCoreElement(LitElement) {
88
88
  }
89
89
 
90
90
  _tagListItemDeleted(e) {
91
- const filterId = e.target.getAttribute('data-filter-id');
92
- const filterValueIndex = e.target.getAttribute('data-index');
91
+ const filterId = e.target.dataset.filterId;
92
+ const filterValueIndex = e.detail.key;
93
93
  const filterValue = this._allActiveFilters.get(filterId)[filterValueIndex];
94
94
  const filter = this._filters.registries.find(filter => filter.id === filterId);
95
95
  filter.requestFilterValueClear(filterValue.keyObject);
@@ -129,7 +129,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
129
129
  top: 0;
130
130
  }
131
131
  [slot="control-container"]::after {
132
- bottom: -2px;
132
+ bottom: -1px;
133
133
  }
134
134
 
135
135
  :host(:first-of-type[_separators="between"]) [slot="control-container"]::before,
@@ -318,6 +318,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
318
318
  :host(:not([selection-disabled]):not([skeleton])[selectable][_focusing]) [slot="outside-control-container"] {
319
319
  background-color: white;
320
320
  border-color: #b6cbe8; /* celestine alpha 0.3 */
321
+ margin-bottom: -1px;
321
322
  }
322
323
  :host([_hovering-primary-action]) [slot="outside-control-container"],
323
324
  :host([_hovering-selection]) [slot="outside-control-container"] {
@@ -326,6 +327,7 @@ export const ListItemMixin = superclass => class extends composeMixins(
326
327
  :host(:not([selection-disabled]):not([skeleton])[selected]) [slot="outside-control-container"] {
327
328
  background-color: #f3fbff;
328
329
  border-color: #b6cbe8; /* celestine alpha 0.3 */
330
+ margin-bottom: -1px;
329
331
  }
330
332
 
331
333
  :host(:not([selection-disabled]):not([skeleton])[padding-type="none"]) [slot="outside-control-container"] {
@@ -57,7 +57,7 @@ class List extends PageableMixin(SelectionMixin(LitElement)) {
57
57
  display: block;
58
58
  }
59
59
  :host(:not([slot="nested"])) > .d2l-list-content {
60
- padding-bottom: 2px;
60
+ padding-bottom: 1px;
61
61
  }
62
62
  :host([hidden]) {
63
63
  display: none;
@@ -37,8 +37,8 @@ The corresponding `*-clear` event must be listened to for whatever component (`d
37
37
  import '@brightspace-ui/core/components/tag-list/tag-list-item.js';
38
38
 
39
39
  document.addEventListener('d2l-tag-list-item-clear', (e) => {
40
+ console.log(`d2l-tag-list-item-clear event dispatched. Key: ${e.detail.key}`);
40
41
  e.target.parentNode.removeChild(e.target);
41
- console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}`);
42
42
  });
43
43
 
44
44
  document.addEventListener('d2l-tag-list-clear', (e) => {
@@ -50,10 +50,10 @@ The corresponding `*-clear` event must be listened to for whatever component (`d
50
50
  });
51
51
  </script>
52
52
  <d2l-tag-list description="Example Tags" clearable>
53
- <d2l-tag-list-item text="Lorem ipsum dolor"></d2l-tag-list-item>
54
- <d2l-tag-list-item text="Reprehenderit in voluptate velit esse lorem ipsum dolor"></d2l-tag-list-item>
55
- <d2l-tag-list-item text="Sit amet"></d2l-tag-list-item>
56
- <d2l-tag-list-item text="Duis aute irure"></d2l-tag-list-item>
53
+ <d2l-tag-list-item key="lorem-ipsum" text="Lorem ipsum dolor"></d2l-tag-list-item>
54
+ <d2l-tag-list-item key="reprehenderit" text="Reprehenderit in voluptate velit esse lorem ipsum dolor"></d2l-tag-list-item>
55
+ <d2l-tag-list-item key="sit-amet" text="Sit amet"></d2l-tag-list-item>
56
+ <d2l-tag-list-item key="duis-aute-irure" text="Duis aute irure"></d2l-tag-list-item>
57
57
  </d2l-tag-list>
58
58
  ```
59
59
 
@@ -67,8 +67,8 @@ The `d2l-tag-list-item` provides the appropriate semantics and styling for child
67
67
  import '@brightspace-ui/core/components/tag-list/tag-list-item.js';
68
68
 
69
69
  document.addEventListener('d2l-tag-list-item-clear', (e) => {
70
+ console.log(`d2l-tag-list-item-clear event dispatched. Key: ${e.detail.key}`);
70
71
  e.target.parentNode.removeChild(e.target);
71
- console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}`);
72
72
  });
73
73
 
74
74
  document.addEventListener('d2l-tag-list-clear', (e) => {
@@ -81,7 +81,7 @@ The `d2l-tag-list-item` provides the appropriate semantics and styling for child
81
81
  </script>
82
82
 
83
83
  <d2l-tag-list description="Example Tags" clearable>
84
- <d2l-tag-list-item text="Tag"></d2l-tag-list-item>
84
+ <d2l-tag-list-item key="tag" text="Tag"></d2l-tag-list-item>
85
85
  </d2l-tag-list>
86
86
  ```
87
87
 
@@ -57,22 +57,22 @@
57
57
  <h2>Clearable Tag List</h2>
58
58
  <d2l-demo-snippet full-width>
59
59
  <d2l-tag-list description="A bunch of example tags" clearable>
60
- <d2l-tag-list-item text="Example 1"></d2l-tag-list-item>
61
- <d2l-tag-list-item text="Example 2 - much much much much much much much much longer"></d2l-tag-list-item>
62
- <d2l-tag-list-item text="Example 3"></d2l-tag-list-item>
63
- <d2l-tag-list-item-mixin-consumer name="Custom Tag List Item"></d2l-tag-list-item-mixin-consumer>
64
- <d2l-tag-list-item text="Example 5"></d2l-tag-list-item>
65
- <d2l-tag-list-item text="Example 6" description="this is a description"></d2l-tag-list-item>
66
- <d2l-tag-list-item text="Example 7"></d2l-tag-list-item>
67
- <d2l-tag-list-item text="Example 8"></d2l-tag-list-item>
68
- <d2l-tag-list-item text="Example 9"></d2l-tag-list-item>
60
+ <d2l-tag-list-item key="example-1" text="Example 1"></d2l-tag-list-item>
61
+ <d2l-tag-list-item key="example-2" text="Example 2 - much much much much much much much much longer"></d2l-tag-list-item>
62
+ <d2l-tag-list-item key="example-3" text="Example 3"></d2l-tag-list-item>
63
+ <d2l-tag-list-item-mixin-consumer key="custom" name="Custom Tag List Item"></d2l-tag-list-item-mixin-consumer>
64
+ <d2l-tag-list-item key="example-5" text="Example 5"></d2l-tag-list-item>
65
+ <d2l-tag-list-item key="example-6" text="Example 6" description="this is a description"></d2l-tag-list-item>
66
+ <d2l-tag-list-item key="example-7" text="Example 7"></d2l-tag-list-item>
67
+ <d2l-tag-list-item key="example-8" text="Example 8"></d2l-tag-list-item>
68
+ <d2l-tag-list-item key="example-9" text="Example 9"></d2l-tag-list-item>
69
69
  </d2l-tag-list>
70
70
  <script type="module">
71
71
  import { getNextFocusable } from '../../../helpers/focus.js';
72
72
 
73
73
  document.addEventListener('d2l-tag-list-item-clear', (e) => {
74
+ console.log(`d2l-tag-list-item-clear event dispatched. Key: ${e.target.key}; Value: ${e.target.text}`);
74
75
  e.target.parentNode.removeChild(e.target);
75
- console.log(`d2l-tag-list-item-clear event dispatched. Value: ${e.detail.value}`);
76
76
  });
77
77
 
78
78
  document.addEventListener('d2l-tag-list-clear', (e) => {
@@ -27,6 +27,11 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
27
27
  * @type {boolean}
28
28
  */
29
29
  clearable: { type: Boolean },
30
+ /**
31
+ * REQUIRED if clearable. Acts as a unique identifier for the tag
32
+ * @type {string}
33
+ */
34
+ key: { type: String },
30
35
  /**
31
36
  * @ignore
32
37
  */
@@ -130,6 +135,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
130
135
  this.keyboardTooltipItem = false;
131
136
  this.keyboardTooltipShown = false;
132
137
  this._id = getUniqueId();
138
+ this._plainText = '';
133
139
  }
134
140
 
135
141
  firstUpdated(changedProperties) {
@@ -166,12 +172,12 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
166
172
  _handleClearItem() {
167
173
  if (!this.clearable) return;
168
174
 
169
- announce(this.localize('components.tag-list.cleared-item', { value: this.text }));
175
+ announce(this.localize('components.tag-list.cleared-item', { value: this._plainText }));
170
176
 
171
177
  /** Dispatched when a user selects to delete an individual tag list item. The consumer must handle the actual element deletion and focus behaviour if there are no remaining list items. */
172
178
  this.dispatchEvent(new CustomEvent(
173
179
  'd2l-tag-list-item-clear',
174
- { bubbles: true, composed: true, detail: { value: this.text } }
180
+ { bubbles: true, composed: true, detail: { key: this.key } }
175
181
  ));
176
182
  }
177
183
 
@@ -209,12 +215,11 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
209
215
  `;
210
216
  }
211
217
 
212
- _renderTag(tagContent, options) {
213
- if (!options) options = {};
218
+ _renderTag(tagContent, options = {}) {
219
+ if (options.plainText?.constructor !== String) throw new TypeError('options.plainText must be a string');
220
+ this._plainText = options.plainText || '';
214
221
 
215
- const buttonText = typeof tagContent === 'object'
216
- ? this.localize('components.tag-list.clear', { value: '' })
217
- : this.localize('components.tag-list.clear', { value: tagContent });
222
+ const buttonText = this.localize('components.tag-list.clear', { value: this._plainText });
218
223
 
219
224
  const hasDescription = !!options.description;
220
225
 
@@ -22,7 +22,8 @@ class TagListItem extends TagListItemMixin(LitElement) {
22
22
  render() {
23
23
  return this._renderTag(this.text, {
24
24
  description: this.description,
25
- hasTruncationTooltip: true
25
+ hasTruncationTooltip: true,
26
+ plainText: this.text
26
27
  });
27
28
  }
28
29
  }
@@ -12235,6 +12235,11 @@
12235
12235
  "description": "Optional: Text to display in tooltip.\nTooltip will also include text property value if truncated.",
12236
12236
  "type": "string"
12237
12237
  },
12238
+ {
12239
+ "name": "key",
12240
+ "description": "REQUIRED if clearable. Acts as a unique identifier for the tag",
12241
+ "type": "string"
12242
+ },
12238
12243
  {
12239
12244
  "name": "clearable",
12240
12245
  "description": "Enables the option to clear a tag list item. The `d2l-tag-list-item-clear` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.",
@@ -12255,6 +12260,12 @@
12255
12260
  "description": "Optional: Text to display in tooltip.\nTooltip will also include text property value if truncated.",
12256
12261
  "type": "string"
12257
12262
  },
12263
+ {
12264
+ "name": "key",
12265
+ "attribute": "key",
12266
+ "description": "REQUIRED if clearable. Acts as a unique identifier for the tag",
12267
+ "type": "string"
12268
+ },
12258
12269
  {
12259
12270
  "name": "clearable",
12260
12271
  "attribute": "clearable",
@@ -12352,6 +12363,11 @@
12352
12363
  "name": "name",
12353
12364
  "type": "string"
12354
12365
  },
12366
+ {
12367
+ "name": "key",
12368
+ "description": "REQUIRED if clearable. Acts as a unique identifier for the tag",
12369
+ "type": "string"
12370
+ },
12355
12371
  {
12356
12372
  "name": "clearable",
12357
12373
  "description": "Enables the option to clear a tag list item. The `d2l-tag-list-item-clear` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.",
@@ -12365,6 +12381,12 @@
12365
12381
  "attribute": "name",
12366
12382
  "type": "string"
12367
12383
  },
12384
+ {
12385
+ "name": "key",
12386
+ "attribute": "key",
12387
+ "description": "REQUIRED if clearable. Acts as a unique identifier for the tag",
12388
+ "type": "string"
12389
+ },
12368
12390
  {
12369
12391
  "name": "clearable",
12370
12392
  "attribute": "clearable",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.131.5",
3
+ "version": "2.131.7",
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",