@brightspace-ui/core 2.15.2 → 2.16.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.
|
@@ -14,6 +14,8 @@ import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.j
|
|
|
14
14
|
window.D2L = window.D2L || {};
|
|
15
15
|
window.D2L.DialogMixin = window.D2L.DialogMixin || {};
|
|
16
16
|
|
|
17
|
+
// while implemented in Webkit, native <dialog> focus mangement across slotted content is buggy
|
|
18
|
+
// https://bugs.webkit.org/show_bug.cgi?id=233320
|
|
17
19
|
window.D2L.DialogMixin.hasNative = (window.HTMLDialogElement !== undefined)
|
|
18
20
|
&& (navigator.vendor && navigator.vendor.toLowerCase().indexOf('apple') === -1);
|
|
19
21
|
if (window.D2L.DialogMixin.preferNative === undefined) {
|
|
@@ -182,7 +184,16 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
182
184
|
return;
|
|
183
185
|
}
|
|
184
186
|
}
|
|
185
|
-
this.shadowRoot.querySelector('d2l-focus-trap')
|
|
187
|
+
const focusTrap = this.shadowRoot.querySelector('d2l-focus-trap');
|
|
188
|
+
if (focusTrap) {
|
|
189
|
+
focusTrap.focus();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const header = this.shadowRoot.querySelector('.d2l-dialog-header');
|
|
193
|
+
if (header) {
|
|
194
|
+
const firstFocusable = getNextFocusable(header);
|
|
195
|
+
if (firstFocusable) forceFocusVisible(firstFocusable);
|
|
196
|
+
}
|
|
186
197
|
}
|
|
187
198
|
|
|
188
199
|
_focusInitial() {
|
|
@@ -412,12 +423,6 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
412
423
|
'd2l-dialog-fullscreen-within': this._fullscreenWithin !== 0
|
|
413
424
|
};
|
|
414
425
|
|
|
415
|
-
inner = html`<d2l-focus-trap
|
|
416
|
-
@d2l-focus-trap-enter="${this._handleFocusTrapEnter}"
|
|
417
|
-
?trap="${this.opened}">
|
|
418
|
-
${inner}
|
|
419
|
-
</d2l-focus-trap>`;
|
|
420
|
-
|
|
421
426
|
return html`${this._useNative ?
|
|
422
427
|
html`<dialog
|
|
423
428
|
aria-describedby="${ifDefined(info.descId)}"
|
|
@@ -443,7 +448,9 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
443
448
|
id="${this._dialogId}"
|
|
444
449
|
role="${info.role}"
|
|
445
450
|
style=${styleMap(styles)}>
|
|
446
|
-
|
|
451
|
+
<d2l-focus-trap
|
|
452
|
+
@d2l-focus-trap-enter="${this._handleFocusTrapEnter}"
|
|
453
|
+
?trap="${this.opened}">${inner}</d2l-focus-trap>
|
|
447
454
|
</div>
|
|
448
455
|
<d2l-backdrop for-target="${this._dialogId}" ?shown="${this._state === 'showing'}"></d2l-backdrop>`}
|
|
449
456
|
`;
|
|
@@ -159,7 +159,8 @@ The filter will announce changes to filter selections, search results, and when
|
|
|
159
159
|
| Property | Type | Description |
|
|
160
160
|
|---|---|---|
|
|
161
161
|
| `disabled` | Boolean, default: `false` | Disables the dropdown opener for the filter |
|
|
162
|
-
| `opened` | Boolean, default: `false` | Whether or not the filter is open
|
|
162
|
+
| `opened` | Boolean, default: `false` | Whether or not the filter is open |
|
|
163
|
+
| `text` | String | Optional override for the button text used for a multi-dimensional filter |
|
|
163
164
|
|
|
164
165
|
### Events
|
|
165
166
|
* `d2l-filter-change`: dispatched when any filter value has changed (may contain info about multiple dimensions and multiple changes in each)
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
<d2l-filter>
|
|
93
93
|
<d2l-filter-dimension-set key="course" text="Course" loading select-all>
|
|
94
94
|
<d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
|
|
95
|
-
<d2l-filter-dimension-set-value key="astronomy" text="Astronomy"
|
|
95
|
+
<d2l-filter-dimension-set-value key="astronomy" text="Astronomy"></d2l-filter-dimension-set-value>
|
|
96
96
|
<d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
|
|
97
97
|
<d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
|
|
98
98
|
<d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
|
|
@@ -105,9 +105,13 @@
|
|
|
105
105
|
</d2l-filter-dimension-set>
|
|
106
106
|
|
|
107
107
|
</d2l-filter>
|
|
108
|
-
<d2l-filter>
|
|
108
|
+
<d2l-filter text="More Filters">
|
|
109
109
|
<d2l-filter-dimension-set key="course" text="Course" loading select-all></d2l-filter-dimension-set>
|
|
110
|
-
<d2l-filter-dimension-set key="role" text="Role" loading
|
|
110
|
+
<d2l-filter-dimension-set key="role" text="Role" loading>
|
|
111
|
+
<d2l-filter-dimension-set-value key="admin" text="Admin"></d2l-filter-dimension-set-value>
|
|
112
|
+
<d2l-filter-dimension-set-value key="instructor" text="Instructor"></d2l-filter-dimension-set-value>
|
|
113
|
+
<d2l-filter-dimension-set-value key="student" text="Student"></d2l-filter-dimension-set-value>
|
|
114
|
+
</d2l-filter-dimension-set>
|
|
111
115
|
<d2l-filter-dimension-set key="semester" text="Semester" loading selection-single></d2l-filter-dimension-set>
|
|
112
116
|
</d2l-filter>
|
|
113
117
|
<d2l-button id="finish-loading">Finish loading (in 5 seconds)</d2l-button>
|
|
@@ -52,6 +52,11 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
52
52
|
* @type {boolean}
|
|
53
53
|
*/
|
|
54
54
|
opened: { type: Boolean, reflect: true },
|
|
55
|
+
/**
|
|
56
|
+
* Optional override for the button text used for a multi-dimensional filter
|
|
57
|
+
* @type {string}
|
|
58
|
+
*/
|
|
59
|
+
text: { type: String },
|
|
55
60
|
_activeDimensionKey: { type: String, attribute: false },
|
|
56
61
|
_dimensions: { type: Array, attribute: false },
|
|
57
62
|
_totalAppliedCount: { type: Number, attribute: false }
|
|
@@ -175,7 +180,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
|
175
180
|
const dimensions = this._buildDimensions(singleDimension);
|
|
176
181
|
|
|
177
182
|
const filterCount = this._formatFilterCount(this._totalAppliedCount);
|
|
178
|
-
let buttonText = singleDimension ? this._dimensions[0].text : this.localize('components.filter.filters');
|
|
183
|
+
let buttonText = singleDimension ? this._dimensions[0].text : (this.text || this.localize('components.filter.filters'));
|
|
179
184
|
if (filterCount) buttonText = `${buttonText} (${filterCount})`;
|
|
180
185
|
|
|
181
186
|
let description = singleDimension ? this.localize('components.filter.singleDimensionDescription', { filterName: this._dimensions[0].text }) : this.localize('components.filter.filters');
|
package/custom-elements.json
CHANGED
|
@@ -3146,6 +3146,11 @@
|
|
|
3146
3146
|
"path": "./components/filter/filter.js",
|
|
3147
3147
|
"description": "A filter component that contains one or more dimensions a user can filter by.\nThis component is in charge of all rendering.",
|
|
3148
3148
|
"attributes": [
|
|
3149
|
+
{
|
|
3150
|
+
"name": "text",
|
|
3151
|
+
"description": "Optional override for the button text used for a multi-dimensional filter",
|
|
3152
|
+
"type": "string"
|
|
3153
|
+
},
|
|
3149
3154
|
{
|
|
3150
3155
|
"name": "disabled",
|
|
3151
3156
|
"description": "Disables the dropdown opener for the filter",
|
|
@@ -3160,6 +3165,12 @@
|
|
|
3160
3165
|
}
|
|
3161
3166
|
],
|
|
3162
3167
|
"properties": [
|
|
3168
|
+
{
|
|
3169
|
+
"name": "text",
|
|
3170
|
+
"attribute": "text",
|
|
3171
|
+
"description": "Optional override for the button text used for a multi-dimensional filter",
|
|
3172
|
+
"type": "string"
|
|
3173
|
+
},
|
|
3163
3174
|
{
|
|
3164
3175
|
"name": "disabled",
|
|
3165
3176
|
"attribute": "disabled",
|
package/helpers/mathjax.js
CHANGED
|
@@ -56,19 +56,24 @@ export class HtmlBlockMathRenderer {
|
|
|
56
56
|
|
|
57
57
|
await loadMathJax(mathJaxConfig);
|
|
58
58
|
|
|
59
|
+
// MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
|
|
60
|
+
// This work-around should be removed when linebreaks are natively supported.
|
|
61
|
+
// MathJax issue: https://github.com/mathjax/MathJax/issues/2312
|
|
62
|
+
// A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
|
|
63
|
+
const lineBreakStyle = 'display: block; height: 0.5rem;';
|
|
64
|
+
|
|
59
65
|
// If we're opting out of deferred rendering, we need to rely
|
|
60
66
|
// on the global MathJax install for rendering.
|
|
61
67
|
if (options.noDeferredRendering) {
|
|
68
|
+
elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
|
|
69
|
+
elm.setAttribute('style', lineBreakStyle);
|
|
70
|
+
});
|
|
62
71
|
await window.MathJax.startup.promise;
|
|
63
72
|
window.MathJax.typeset([elem]);
|
|
64
73
|
return elem;
|
|
65
74
|
}
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
// This work-around should be removed when linebreaks are natively supported.
|
|
69
|
-
// MathJax issue: https://github.com/mathjax/MathJax/issues/2312
|
|
70
|
-
// A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
|
|
71
|
-
const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', '<mspace linebreak="newline" style="display: block; height: 0.5rem;">');
|
|
76
|
+
const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', `<mspace linebreak="newline" style="${lineBreakStyle}">`);
|
|
72
77
|
|
|
73
78
|
const temp = document.createElement('div');
|
|
74
79
|
temp.style.display = 'none';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.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",
|