@brightspace-ui/core 2.43.5 → 2.44.0
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.
- package/components/tag-list/README.md +7 -0
- package/components/tag-list/demo/tag-list.html +10 -0
- package/components/tag-list/tag-list-item-mixin.js +12 -6
- package/components/tag-list/tag-list-item.js +8 -2
- package/components/tag-list/tag-list.js +0 -1
- package/custom-elements.json +11 -0
- package/package.json +1 -1
|
@@ -76,3 +76,10 @@ The `d2l-tag-list-item` provides the appropriate `listitem` semantics and stylin
|
|
|
76
76
|
<d2l-tag-list-item text="Tag"></d2l-tag-list-item>
|
|
77
77
|
</d2l-tag-list>
|
|
78
78
|
```
|
|
79
|
+
|
|
80
|
+
### `d2l-tag-list-item` properties
|
|
81
|
+
|
|
82
|
+
| Property | Type | Description |
|
|
83
|
+
|--|--|--|
|
|
84
|
+
| `text` | String, required | Text displayed on the tag item. Will truncate automatically if text exceeds a certain width and will display full `text` value in a tooltip. |
|
|
85
|
+
| `description` | String, optional | Additional text to display in tag item tooltip. Setting this property will make tooltip available at all times when hovering. |
|
|
@@ -86,6 +86,16 @@
|
|
|
86
86
|
</div>
|
|
87
87
|
</d2l-demo-snippet>
|
|
88
88
|
|
|
89
|
+
<h2>Tag List - Custom Tooltip Description</h2>
|
|
90
|
+
<d2l-demo-snippet fullscreen>
|
|
91
|
+
<d2l-tag-list description="A bunch of example tags">
|
|
92
|
+
<d2l-tag-list-item text="Longer Example Tag - much much much much much longer" description="display text and description value when truncated"></d2l-tag-list-item>
|
|
93
|
+
<d2l-tag-list-item text="Example Tag 5" description="custom tooltip text - display description only when not truncated"></d2l-tag-list-item>
|
|
94
|
+
<d2l-tag-list-item text="Truncated list item without a custom tooltip description"></d2l-tag-list-item>
|
|
95
|
+
<d2l-tag-list-item text="No tooltip"></d2l-tag-list-item>
|
|
96
|
+
</d2l-tag-list>
|
|
97
|
+
</d2l-demo-snippet>
|
|
98
|
+
|
|
89
99
|
</d2l-demo-page>
|
|
90
100
|
</body>
|
|
91
101
|
</html>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../button/button-icon.js';
|
|
2
2
|
import '../colors/colors.js';
|
|
3
3
|
import '../tooltip/tooltip.js';
|
|
4
|
-
import { css, html } from 'lit';
|
|
4
|
+
import { css, html, nothing } from 'lit';
|
|
5
|
+
import { heading4Styles, labelStyles } from '../typography/styles.js';
|
|
5
6
|
import { announce } from '../../helpers/announce.js';
|
|
6
7
|
import { classMap } from 'lit/directives/class-map.js';
|
|
7
8
|
import { findComposedAncestor } from '../../helpers/dom.js';
|
|
8
9
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
9
|
-
import { labelStyles } from '../typography/styles.js';
|
|
10
10
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
11
11
|
import { RtlMixin } from '../../mixins/rtl-mixin.js';
|
|
12
12
|
|
|
@@ -39,7 +39,7 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
static get styles() {
|
|
42
|
-
return [labelStyles, css`
|
|
42
|
+
return [labelStyles, heading4Styles, css`
|
|
43
43
|
:host {
|
|
44
44
|
display: grid;
|
|
45
45
|
max-width: 100%;
|
|
@@ -120,6 +120,9 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
|
|
|
120
120
|
.d2l-tag-list-item-tooltip-title-key {
|
|
121
121
|
font-weight: 600;
|
|
122
122
|
}
|
|
123
|
+
.d2l-heading-4 {
|
|
124
|
+
margin: 0 0 0.5rem 0;
|
|
125
|
+
}
|
|
123
126
|
`];
|
|
124
127
|
}
|
|
125
128
|
|
|
@@ -200,13 +203,16 @@ export const TagListItemMixin = superclass => class extends LocalizeCoreElement(
|
|
|
200
203
|
));
|
|
201
204
|
}
|
|
202
205
|
|
|
203
|
-
_renderTag(tagContent, hasTruncationTooltip) {
|
|
206
|
+
_renderTag(tagContent, hasTruncationTooltip, description) {
|
|
204
207
|
const buttonText = typeof tagContent === 'object'
|
|
205
208
|
? this.localize('components.tag-list.clear', { value: '' })
|
|
206
209
|
: this.localize('components.tag-list.clear', { value: tagContent });
|
|
210
|
+
const hasDescription = !!description;
|
|
211
|
+
const tooltipHeader = hasDescription ? html`<div class="d2l-heading-4">${tagContent}</div>` : tagContent;
|
|
207
212
|
const tooltipTagOverflow = hasTruncationTooltip ? html`
|
|
208
|
-
<d2l-tooltip for="${this._id}" show-truncated-only>
|
|
209
|
-
${
|
|
213
|
+
<d2l-tooltip for="${this._id}" ?show-truncated-only="${!hasDescription}">
|
|
214
|
+
${tooltipHeader}
|
|
215
|
+
${hasDescription ? description : nothing}
|
|
210
216
|
</d2l-tooltip>
|
|
211
217
|
` : null;
|
|
212
218
|
const tooltipKeyboardInstructions = this._displayKeyboardTooltip ? html`
|
|
@@ -9,12 +9,18 @@ class TagListItem extends TagListItemMixin(LitElement) {
|
|
|
9
9
|
* REQUIRED: Text to display
|
|
10
10
|
* @type {string}
|
|
11
11
|
*/
|
|
12
|
-
text: { type: String }
|
|
12
|
+
text: { type: String },
|
|
13
|
+
/**
|
|
14
|
+
* Optional: Text to display in tooltip.
|
|
15
|
+
* Tooltip will also include text property value if truncated.
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
description: { type: String }
|
|
13
19
|
};
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
render() {
|
|
17
|
-
return this._renderTag(this.text, true);
|
|
23
|
+
return this._renderTag(this.text, true, this.description);
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
|
package/custom-elements.json
CHANGED
|
@@ -10326,6 +10326,11 @@
|
|
|
10326
10326
|
"description": "REQUIRED: Text to display",
|
|
10327
10327
|
"type": "string"
|
|
10328
10328
|
},
|
|
10329
|
+
{
|
|
10330
|
+
"name": "description",
|
|
10331
|
+
"description": "Optional: Text to display in tooltip.\nTooltip will also include text property value if truncated.",
|
|
10332
|
+
"type": "string"
|
|
10333
|
+
},
|
|
10329
10334
|
{
|
|
10330
10335
|
"name": "clearable",
|
|
10331
10336
|
"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.",
|
|
@@ -10340,6 +10345,12 @@
|
|
|
10340
10345
|
"description": "REQUIRED: Text to display",
|
|
10341
10346
|
"type": "string"
|
|
10342
10347
|
},
|
|
10348
|
+
{
|
|
10349
|
+
"name": "description",
|
|
10350
|
+
"attribute": "description",
|
|
10351
|
+
"description": "Optional: Text to display in tooltip.\nTooltip will also include text property value if truncated.",
|
|
10352
|
+
"type": "string"
|
|
10353
|
+
},
|
|
10343
10354
|
{
|
|
10344
10355
|
"name": "clearable",
|
|
10345
10356
|
"attribute": "clearable",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
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",
|