@brightspace-ui/core 2.47.0 → 2.47.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Description List
|
|
2
|
-
A Description List displays
|
|
2
|
+
A Description List displays static pairs of terms and definitions in a vertical list. In the standard HTML element `dl` these are called "terms" `dt` and "definitions" `dd`.
|
|
3
3
|
|
|
4
4
|
<!-- docs: demo -->
|
|
5
5
|
```html
|
|
@@ -10,16 +10,20 @@ A Description List displays information in a vertical list of key-value pairs. C
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Best Practices
|
|
13
|
+
|
|
13
14
|
<!-- docs: start best practices -->
|
|
14
15
|
<!-- docs: start dos -->
|
|
15
|
-
*
|
|
16
|
+
* Keep terms short and scannable
|
|
17
|
+
* Use terms of similar lengths since definitions are aligned to the longest term
|
|
18
|
+
* Use title case for terms and sentence case for definitions
|
|
19
|
+
* Adjust the [responsive breakpoint](#responsive-behavior) to suit your content since longer values may need a higher breakpoint
|
|
16
20
|
<!-- docs: end dos -->
|
|
17
21
|
|
|
18
22
|
<!-- docs: start donts -->
|
|
19
|
-
*
|
|
20
|
-
* Don't
|
|
21
|
-
* Don't
|
|
22
|
-
* Don't
|
|
23
|
+
* Avoid using multiple description lists on one page
|
|
24
|
+
* Don't use empty terms or definitions, both are required
|
|
25
|
+
* Don't use colons in the labels, they're unnecessary
|
|
26
|
+
* Don't end a definition with a period unless it has multiple sentences
|
|
23
27
|
<!-- docs: end donts -->
|
|
24
28
|
<!-- docs: end best practices -->
|
|
25
29
|
|
|
@@ -42,11 +46,14 @@ When the component width is less than the `breakpoint` property, the side-by-sid
|
|
|
42
46
|
return html`
|
|
43
47
|
<d2l-dl-wrapper breakpoint="600">
|
|
44
48
|
<dl>
|
|
45
|
-
<dt>
|
|
46
|
-
<dd>
|
|
49
|
+
<dt>Active Course</dt>
|
|
50
|
+
<dd>Inactive courses are invisible, regardless of start or end dates unless the user’s role has the permission "Can View Inactive Courses"</dd>
|
|
51
|
+
|
|
52
|
+
<dt>Start Date</dt>
|
|
53
|
+
<dd>The start date determines when a course becomes available to learners. Users with the "Can View Course Before Start Date" permission are excluded from this restriction.</dd>
|
|
47
54
|
|
|
48
|
-
<dt>
|
|
49
|
-
<dd>The
|
|
55
|
+
<dt>End Date</dt>
|
|
56
|
+
<dd>The end date determines when a course becomes unavailable to learners. Users with the "Can View Course After End Date" permission are excluded from this restriction.</dd>
|
|
50
57
|
</dl>
|
|
51
58
|
</d2l-dl-wrapper>
|
|
52
59
|
`;
|
|
@@ -60,9 +67,9 @@ When the component width is less than the `breakpoint` property, the side-by-sid
|
|
|
60
67
|
|
|
61
68
|
## Description List Wrapper [d2l-dl-wrapper]
|
|
62
69
|
|
|
63
|
-
The `d2l-dl-wrapper` can be combined with `descriptionListStyles` to apply styling and resize behavior to native `dl` elements.
|
|
70
|
+
The `d2l-dl-wrapper` component can be combined with `descriptionListStyles` to apply styling and resize behavior to native `dl` elements.
|
|
64
71
|
|
|
65
|
-
<!-- docs: demo live name:d2l-test-dl -->
|
|
72
|
+
<!-- docs: demo live name:d2l-test-dl display:block -->
|
|
66
73
|
```html
|
|
67
74
|
<script type="module">
|
|
68
75
|
import { html, LitElement } from 'lit';
|
|
@@ -84,11 +91,17 @@ The `d2l-dl-wrapper` can be combined with `descriptionListStyles` to apply styli
|
|
|
84
91
|
return html`
|
|
85
92
|
<d2l-dl-wrapper breakpoint="${this.breakpoint}">
|
|
86
93
|
<dl>
|
|
87
|
-
<dt>Course
|
|
88
|
-
<dd>
|
|
94
|
+
<dt>Course Name</dt>
|
|
95
|
+
<dd>Brightspace 101B</dd>
|
|
96
|
+
|
|
97
|
+
<dt>Course Code</dt>
|
|
98
|
+
<dd>BSPC 101B</dd>
|
|
99
|
+
|
|
100
|
+
<dt>Start Date</dt>
|
|
101
|
+
<dd>June 14 2022</dd>
|
|
89
102
|
|
|
90
|
-
<dt>
|
|
91
|
-
<dd>
|
|
103
|
+
<dt>Semester</dt>
|
|
104
|
+
<dd>2022 Summer</dd>
|
|
92
105
|
</dl>
|
|
93
106
|
</d2l-dl-wrapper>
|
|
94
107
|
`;
|
|
@@ -194,11 +194,17 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
194
194
|
this.noDeferredRendering = false;
|
|
195
195
|
this._hasSlottedContent = false;
|
|
196
196
|
|
|
197
|
+
this._contextObserverControllerResolve = undefined;
|
|
198
|
+
this._contextObserverControllerInitialized = new Promise(resolve => {
|
|
199
|
+
this._contextObserverControllerResolve = resolve;
|
|
200
|
+
});
|
|
201
|
+
|
|
197
202
|
getRenderers().then(renderers => renderers.reduce((attrs, currentRenderer) => {
|
|
198
203
|
if (currentRenderer.contextAttributes) currentRenderer.contextAttributes.forEach(attr => attrs.push(attr));
|
|
199
204
|
return attrs;
|
|
200
205
|
}, [])).then(rendererContextAttributes => {
|
|
201
206
|
this._contextObserverController = new HtmlAttributeObserverController(this, ...rendererContextAttributes);
|
|
207
|
+
this._contextObserverControllerResolve();
|
|
202
208
|
});
|
|
203
209
|
}
|
|
204
210
|
|
|
@@ -245,7 +251,7 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
245
251
|
if (changedProperties.has('html') && this.html !== undefined && this.html !== null && !this._hasSlottedContent) {
|
|
246
252
|
await this._updateRenderContainer();
|
|
247
253
|
}
|
|
248
|
-
if (this._contextChanged()) {
|
|
254
|
+
if (await this._contextChanged()) {
|
|
249
255
|
if (this._hasSlottedContent) this._render();
|
|
250
256
|
else if (this.html !== undefined && this.html !== null) {
|
|
251
257
|
await this._updateRenderContainer();
|
|
@@ -255,8 +261,8 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
263
|
|
|
258
|
-
_contextChanged() {
|
|
259
|
-
|
|
264
|
+
async _contextChanged() {
|
|
265
|
+
await this._contextObserverControllerInitialized;
|
|
260
266
|
if (!this._contextKeys) {
|
|
261
267
|
this._updateContextKeys();
|
|
262
268
|
return true;
|
|
@@ -290,9 +296,10 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
290
296
|
}
|
|
291
297
|
|
|
292
298
|
async _processRenderers(elem) {
|
|
299
|
+
await this._contextObserverControllerInitialized;
|
|
293
300
|
const renderers = await getRenderers();
|
|
294
301
|
for (const renderer of renderers) {
|
|
295
|
-
if (
|
|
302
|
+
if (renderer.contextAttributes) {
|
|
296
303
|
const contextValues = new Map();
|
|
297
304
|
renderer.contextAttributes.forEach(attr => contextValues.set(attr, this._contextObserverController.values.get(attr)));
|
|
298
305
|
await renderer.render(elem, {
|
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
text-overflow: ellipsis;
|
|
55
55
|
white-space: nowrap;
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
.dark-background {
|
|
59
|
+
background-color: black;
|
|
60
|
+
padding: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
</style>
|
|
58
64
|
</head>
|
|
59
65
|
|
|
@@ -152,6 +158,18 @@
|
|
|
152
158
|
</template>
|
|
153
159
|
</d2l-demo-snippet>
|
|
154
160
|
|
|
161
|
+
<h2>Tooltip (dark background)</h2>
|
|
162
|
+
<d2l-demo-snippet>
|
|
163
|
+
<template>
|
|
164
|
+
<div class="dark-background">
|
|
165
|
+
<d2l-button id="tooltip-dark-background">Dark Background</d2l-button>
|
|
166
|
+
<d2l-tooltip for="tooltip-dark-background">
|
|
167
|
+
All tooltips have an outline.
|
|
168
|
+
</d2l-tooltip>
|
|
169
|
+
</div>
|
|
170
|
+
</template>
|
|
171
|
+
</d2l-demo-snippet>
|
|
172
|
+
|
|
155
173
|
<h2>Help Tooltip</h2>
|
|
156
174
|
<d2l-demo-snippet>
|
|
157
175
|
<template>
|
|
@@ -23,6 +23,7 @@ const defaultViewportMargin = 18;
|
|
|
23
23
|
const contentBorderRadius = 6;
|
|
24
24
|
const contentBorderSize = 1;
|
|
25
25
|
const contentHorizontalPadding = 15;
|
|
26
|
+
const outlineSize = 1;
|
|
26
27
|
|
|
27
28
|
/* once a user shows a tooltip, ignore delay if they hover adjacent target within this timeout */
|
|
28
29
|
let delayTimeoutId;
|
|
@@ -179,6 +180,7 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
179
180
|
:host {
|
|
180
181
|
--d2l-tooltip-background-color: var(--d2l-color-ferrite); /* Deprecated, use state attribute instead */
|
|
181
182
|
--d2l-tooltip-border-color: var(--d2l-color-ferrite); /* Deprecated, use state attribute instead */
|
|
183
|
+
--d2l-tooltip-outline-color: rgba(255, 255, 255, 0.32);
|
|
182
184
|
box-sizing: border-box;
|
|
183
185
|
color: white;
|
|
184
186
|
display: none;
|
|
@@ -273,6 +275,26 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
273
275
|
width: ${pointerLength}px;
|
|
274
276
|
}
|
|
275
277
|
|
|
278
|
+
:host([_open-dir="top"]) .d2l-tooltip-pointer-outline {
|
|
279
|
+
clip: rect(${pointerOverhang + contentBorderSize + outlineSize * 2}px, 21px, 22px, -3px);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
:host([_open-dir="bottom"]) .d2l-tooltip-pointer-outline {
|
|
283
|
+
clip: rect(-4px, 21px, ${pointerOverhang + contentBorderSize - outlineSize * 2}px, -7px);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:host([_open-dir="left"]) .d2l-tooltip-pointer-outline {
|
|
287
|
+
clip: rect(-3px, 21px, 21px, ${pointerOverhang + contentBorderSize + outlineSize * 2}px);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
:host([_open-dir="right"]) .d2l-tooltip-pointer-outline {
|
|
291
|
+
clip: rect(-3px, ${pointerOverhang + contentBorderSize - outlineSize * 2}px, 21px, -4px);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.d2l-tooltip-pointer-outline > div {
|
|
295
|
+
outline: ${outlineSize}px solid var(--d2l-tooltip-outline-color);
|
|
296
|
+
}
|
|
297
|
+
|
|
276
298
|
.d2l-tooltip-position {
|
|
277
299
|
display: inline-block;
|
|
278
300
|
height: 0;
|
|
@@ -295,6 +317,7 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
295
317
|
max-width: 17.5rem;
|
|
296
318
|
min-height: 2.1rem;
|
|
297
319
|
min-width: 2.1rem;
|
|
320
|
+
outline: ${outlineSize}px solid var(--d2l-tooltip-outline-color);
|
|
298
321
|
overflow: hidden;
|
|
299
322
|
padding: ${11 - contentBorderSize}px ${contentHorizontalPadding - contentBorderSize}px;
|
|
300
323
|
position: absolute;
|
|
@@ -476,6 +499,9 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
|
476
499
|
</div>
|
|
477
500
|
</div>
|
|
478
501
|
</div>
|
|
502
|
+
<div class="d2l-tooltip-pointer d2l-tooltip-pointer-outline">
|
|
503
|
+
<div></div>
|
|
504
|
+
</div>
|
|
479
505
|
<div class="d2l-tooltip-pointer">
|
|
480
506
|
<div></div>
|
|
481
507
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.47.
|
|
3
|
+
"version": "2.47.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",
|