@brightspace-ui/core 2.86.5 → 2.87.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/filter/README.md +1 -0
- package/components/filter/demo/filter.html +2 -2
- package/components/filter/filter-dimension-set.js +6 -0
- package/components/filter/filter.js +31 -3
- package/components/scroll-wrapper/scroll-wrapper.js +1 -1
- package/components/table/table-wrapper.js +6 -6
- package/custom-elements.json +13 -0
- package/package.json +1 -1
|
@@ -188,6 +188,7 @@ The `d2l-filter-dimension-set` component is the main dimension type that will wo
|
|
|
188
188
|
|
|
189
189
|
| Property | Type | Description |
|
|
190
190
|
|---|---|---|
|
|
191
|
+
| `introductory-text` | String | The introductory text to display at the top of the filter dropdown |
|
|
191
192
|
| `key` | String, required | Unique identifier for the dimension |
|
|
192
193
|
| `loading` | Boolean | Whether the values for this dimension are still loading and a loading spinner should be displayed |
|
|
193
194
|
| `search-type` | String, default: `automatic` | `automatic` provides basic case-insensitive text comparison searching, `none` disables the search input, and `manual` fires an event for the consumer to handle the search and pass the keys of the values to be displayed |
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<d2l-demo-snippet>
|
|
24
24
|
<template>
|
|
25
25
|
<d2l-filter>
|
|
26
|
-
<d2l-filter-dimension-set key="course" text="Course" select-all>
|
|
26
|
+
<d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." text="Course" select-all>
|
|
27
27
|
<d2l-filter-dimension-set-value key="art" text="Art" count="12"></d2l-filter-dimension-set-value>
|
|
28
28
|
<d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="2" selected></d2l-filter-dimension-set-value>
|
|
29
29
|
<d2l-filter-dimension-set-value key="biology" text="Biology" count="15"></d2l-filter-dimension-set-value>
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<d2l-demo-snippet>
|
|
59
59
|
<template>
|
|
60
60
|
<d2l-filter>
|
|
61
|
-
<d2l-filter-dimension-set key="course" text="Course" select-all>
|
|
61
|
+
<d2l-filter-dimension-set key="course" introductory-text="Filter content by courses. Start typing any course name to explore." text="Course" select-all>
|
|
62
62
|
<d2l-filter-dimension-set-value key="art" text="Art" count="0"></d2l-filter-dimension-set-value>
|
|
63
63
|
<d2l-filter-dimension-set-value key="astronomy" text="Astronomy" count="1" selected></d2l-filter-dimension-set-value>
|
|
64
64
|
<d2l-filter-dimension-set-value key="biology" text="Biology" count="-12"></d2l-filter-dimension-set-value>
|
|
@@ -34,6 +34,11 @@ class FilterDimensionSet extends LitElement {
|
|
|
34
34
|
* @type {boolean}
|
|
35
35
|
*/
|
|
36
36
|
selectionSingle: { type: Boolean, attribute: 'selection-single' },
|
|
37
|
+
/**
|
|
38
|
+
* The introductory text to display at the top of the filter dropdown
|
|
39
|
+
* @type {string}
|
|
40
|
+
*/
|
|
41
|
+
introductoryText: { type: String, attribute: 'introductory-text' },
|
|
37
42
|
/**
|
|
38
43
|
* REQUIRED: The text that is displayed for the dimension title
|
|
39
44
|
* @type {string}
|
|
@@ -49,6 +54,7 @@ class FilterDimensionSet extends LitElement {
|
|
|
49
54
|
|
|
50
55
|
constructor() {
|
|
51
56
|
super();
|
|
57
|
+
this.introductoryText = '';
|
|
52
58
|
this.loading = false;
|
|
53
59
|
this.searchType = 'automatic';
|
|
54
60
|
this.selectAll = false;
|
|
@@ -74,6 +74,10 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
74
74
|
padding-bottom: 0.9rem;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
.d2l-filter-dimension-header.with-intro {
|
|
78
|
+
padding-bottom: 0.6rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
77
81
|
.d2l-filter-dimension-header,
|
|
78
82
|
.d2l-filter-dimension-header-actions {
|
|
79
83
|
align-items: center;
|
|
@@ -142,6 +146,16 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
142
146
|
color: var(--d2l-color-chromite);
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
.d2l-filter-dimension-intro-text {
|
|
150
|
+
margin: 0;
|
|
151
|
+
padding: 0.6rem 1.5rem 1.5rem;
|
|
152
|
+
text-align: center;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.d2l-filter-dimension-intro-text.multi-dimension {
|
|
156
|
+
padding: 0 1.5rem 1.5rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
145
159
|
.d2l-filter-dimension-info-message {
|
|
146
160
|
padding: 0.9rem 0;
|
|
147
161
|
text-align: center;
|
|
@@ -322,6 +336,14 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
322
336
|
|
|
323
337
|
const dimension = this._getActiveDimension();
|
|
324
338
|
|
|
339
|
+
const introductoryTextClasses = {
|
|
340
|
+
'd2l-body-compact': true,
|
|
341
|
+
'd2l-filter-dimension-intro-text': true,
|
|
342
|
+
'multi-dimension': !singleDimension
|
|
343
|
+
};
|
|
344
|
+
const introductoryText = !dimension.introductoryText ? nothing : html`
|
|
345
|
+
<p class="${classMap(introductoryTextClasses)}">${dimension.introductoryText}</p>`;
|
|
346
|
+
|
|
325
347
|
const clear = html`
|
|
326
348
|
<d2l-button-subtle
|
|
327
349
|
@click="${this._handleClear}"
|
|
@@ -331,7 +353,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
331
353
|
</d2l-button-subtle>
|
|
332
354
|
`;
|
|
333
355
|
|
|
334
|
-
const search = dimension.searchType === 'none' ?
|
|
356
|
+
const search = dimension.searchType === 'none' ? nothing : html`
|
|
335
357
|
<d2l-input-search
|
|
336
358
|
@d2l-input-search-searched="${this._handleSearch}"
|
|
337
359
|
?disabled="${this._isDimensionEmpty(dimension)}"
|
|
@@ -360,8 +382,12 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
360
382
|
</div>
|
|
361
383
|
`;
|
|
362
384
|
|
|
363
|
-
const
|
|
364
|
-
|
|
385
|
+
const headerClasses = {
|
|
386
|
+
'd2l-filter-dimension-header': true,
|
|
387
|
+
'with-intro': dimension.introductoryText
|
|
388
|
+
};
|
|
389
|
+
const header = singleDimension ? nothing : html`
|
|
390
|
+
<div class="${classMap(headerClasses)}">
|
|
365
391
|
<d2l-button-icon
|
|
366
392
|
@click="${this._handleDimensionHide}"
|
|
367
393
|
icon="tier1:chevron-left"
|
|
@@ -374,6 +400,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
374
400
|
return html`
|
|
375
401
|
<div slot="header" @keydown="${this._handleDimensionHideKeyDown}">
|
|
376
402
|
${header}
|
|
403
|
+
${introductoryText}
|
|
377
404
|
${actions}
|
|
378
405
|
</div>
|
|
379
406
|
`;
|
|
@@ -654,6 +681,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
654
681
|
|
|
655
682
|
switch (type) {
|
|
656
683
|
case 'd2l-filter-dimension-set': {
|
|
684
|
+
info.introductoryText = dimension.introductoryText;
|
|
657
685
|
info.searchType = dimension.searchType;
|
|
658
686
|
info.selectionSingle = dimension.selectionSingle;
|
|
659
687
|
if (dimension.selectAll && !dimension.selectionSingle) info.selectAllIdPrefix = SET_DIMENSION_ID_PREFIX;
|
|
@@ -140,11 +140,11 @@ export const tableStyles = css`
|
|
|
140
140
|
/* first column that's sticky: offset by size of border-radius so top/bottom border doesn't show through (default style only) */
|
|
141
141
|
d2l-table-wrapper[sticky-headers][type="default"]:not([dir="rtl"]) .d2l-table > * > tr > .d2l-table-sticky-cell.d2l-table-cell-first,
|
|
142
142
|
d2l-table-wrapper[sticky-headers][type="default"]:not([dir="rtl"]) .d2l-table > * > tr > [sticky].d2l-table-cell-first {
|
|
143
|
-
left: var(--d2l-table-border-radius-sticky-offset);
|
|
143
|
+
left: var(--d2l-table-border-radius-sticky-offset, 0);
|
|
144
144
|
}
|
|
145
145
|
d2l-table-wrapper[sticky-headers][type="default"][dir="rtl"] .d2l-table > * > tr > .d2l-table-sticky-cell.d2l-table-cell-first,
|
|
146
146
|
d2l-table-wrapper[sticky-headers][type="default"][dir="rtl"] .d2l-table > * > tr > [sticky].d2l-table-cell-first {
|
|
147
|
-
right: var(--d2l-table-border-radius-sticky-offset);
|
|
147
|
+
right: var(--d2l-table-border-radius-sticky-offset, 0);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/* non-header sticky cells */
|
|
@@ -233,7 +233,7 @@ export class TableWrapper extends RtlMixin(SelectionMixin(LitElement)) {
|
|
|
233
233
|
}
|
|
234
234
|
.d2l-sticky-headers-backdrop {
|
|
235
235
|
position: sticky;
|
|
236
|
-
top: calc(var(--d2l-table-sticky-top) + var(--d2l-table-border-radius));
|
|
236
|
+
top: calc(var(--d2l-table-sticky-top, 0px) + var(--d2l-table-border-radius));
|
|
237
237
|
width: 100%;
|
|
238
238
|
z-index: 2; /* Must sit under d2l-table sticky-headers but over sticky columns and regular cells */
|
|
239
239
|
}
|
|
@@ -418,15 +418,15 @@ export class TableWrapper extends RtlMixin(SelectionMixin(LitElement)) {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
_updateStickyTops() {
|
|
421
|
-
if (!this._table || !this.stickyHeaders) return;
|
|
422
|
-
|
|
423
421
|
const hasStickyControls = this._controls && !this._controls.noSticky;
|
|
424
422
|
let rowTop = hasStickyControls ? this._controls.offsetHeight + 6 : 0; // +6 for the internal `margin-bottom`.
|
|
425
423
|
this.style.setProperty('--d2l-table-sticky-top', `${rowTop}px`);
|
|
426
424
|
|
|
425
|
+
if (!this._table || !this.stickyHeaders) return;
|
|
426
|
+
|
|
427
427
|
const stickyRows = Array.from(this._table.querySelectorAll('tr.d2l-table-header, tr[header], thead tr'));
|
|
428
428
|
stickyRows.forEach(r => {
|
|
429
|
-
const thTop = hasStickyControls ? `${rowTop}px` : `calc(${rowTop}px + var(--d2l-table-border-radius-sticky-offset))`;
|
|
429
|
+
const thTop = hasStickyControls ? `${rowTop}px` : `calc(${rowTop}px + var(--d2l-table-border-radius-sticky-offset, 0px))`;
|
|
430
430
|
const ths = Array.from(r.querySelectorAll('th'));
|
|
431
431
|
ths.forEach(th => th.style.top = thTop);
|
|
432
432
|
|
package/custom-elements.json
CHANGED
|
@@ -3573,6 +3573,12 @@
|
|
|
3573
3573
|
"description": "REQUIRED: Unique key to represent this dimension in the filter",
|
|
3574
3574
|
"type": "string"
|
|
3575
3575
|
},
|
|
3576
|
+
{
|
|
3577
|
+
"name": "introductory-text",
|
|
3578
|
+
"description": "The introductory text to display at the top of the filter dropdown",
|
|
3579
|
+
"type": "string",
|
|
3580
|
+
"default": "\"\""
|
|
3581
|
+
},
|
|
3576
3582
|
{
|
|
3577
3583
|
"name": "loading",
|
|
3578
3584
|
"description": "Whether the values for this dimension are still loading and a loading spinner should be displayed",
|
|
@@ -3617,6 +3623,13 @@
|
|
|
3617
3623
|
"description": "REQUIRED: Unique key to represent this dimension in the filter",
|
|
3618
3624
|
"type": "string"
|
|
3619
3625
|
},
|
|
3626
|
+
{
|
|
3627
|
+
"name": "introductoryText",
|
|
3628
|
+
"attribute": "introductory-text",
|
|
3629
|
+
"description": "The introductory text to display at the top of the filter dropdown",
|
|
3630
|
+
"type": "string",
|
|
3631
|
+
"default": "\"\""
|
|
3632
|
+
},
|
|
3620
3633
|
{
|
|
3621
3634
|
"name": "loading",
|
|
3622
3635
|
"attribute": "loading",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.87.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",
|