@brightspace-ui/core 2.29.1 → 2.29.4
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.
|
@@ -161,7 +161,7 @@ The filter will announce changes to filter selections, search results, and when
|
|
|
161
161
|
|
|
162
162
|
## Filter Dimension: Set [d2l-filter-dimension-set]
|
|
163
163
|
|
|
164
|
-
The `d2l-filter-dimension-set` component is the main dimension type that will work for most use cases. Used alongside the [d2l-filter-dimension-set-value](#
|
|
164
|
+
The `d2l-filter-dimension-set` component is the main dimension type that will work for most use cases. Used alongside the [d2l-filter-dimension-set-value](#d2l-filter-dimension-set-value), this will give you a selectable list of filter values.
|
|
165
165
|
|
|
166
166
|
<!-- docs: demo live name:d2l-filter-dimension-set align:start autoOpen:true autoSize:false size:large -->
|
|
167
167
|
```html
|
|
@@ -198,8 +198,24 @@ The `d2l-filter-dimension-set` component is the main dimension type that will wo
|
|
|
198
198
|
<!-- docs: end hidden content -->
|
|
199
199
|
|
|
200
200
|
## Filter Dimension: Set Value [d2l-filter-dimension-set-value]
|
|
201
|
-
This component is built to be used alongside the [d2l-filter-dimension-set](#filter-dimension%3A-set-%5Bd2l-filter-dimension-set%5D) component, this will give you a selectable list of filter values.
|
|
202
201
|
|
|
202
|
+
This component is built to be used alongside the [d2l-filter-dimension-set](#d2l-filter-dimension-set) component, this will give you a selectable list of filter values.
|
|
203
|
+
|
|
204
|
+
<!-- docs: demo live name:d2l-filter-dimension-set-value align:start autoOpen:true autoSize:false size:large -->
|
|
205
|
+
```html
|
|
206
|
+
<script type="module">
|
|
207
|
+
import '@brightspace-ui/core/components/filter/filter.js';
|
|
208
|
+
import '@brightspace-ui/core/components/filter/filter-dimension-set.js';
|
|
209
|
+
import '@brightspace-ui/core/components/filter/filter-dimension-set-value.js';
|
|
210
|
+
</script>
|
|
211
|
+
<d2l-filter>
|
|
212
|
+
<d2l-filter-dimension-set key="course" text="Course" >
|
|
213
|
+
<d2l-filter-dimension-set-value key="art" text="Art" selected></d2l-filter-dimension-set-value>
|
|
214
|
+
<d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
|
|
215
|
+
</d2l-filter-dimension-set>
|
|
216
|
+
</d2l-filter>
|
|
217
|
+
```
|
|
218
|
+
<!-- docs: start hidden content -->
|
|
203
219
|
### Properties
|
|
204
220
|
|
|
205
221
|
| Property | Type | Description |
|
|
@@ -208,6 +224,7 @@ This component is built to be used alongside the [d2l-filter-dimension-set](#fil
|
|
|
208
224
|
| `key` | String, required | Unique identifier within a dimension for the value |
|
|
209
225
|
| `text` | String, required | Text for the value in the list |
|
|
210
226
|
| `selected` | Boolean, default: `false` | Whether the value in the filter is selected or not |
|
|
227
|
+
<!-- docs: end hidden content -->
|
|
211
228
|
|
|
212
229
|
## Tags for Applied Filters [d2l-filter-tags]
|
|
213
230
|
|
|
@@ -7,20 +7,31 @@ Tooltips display additional information when users focus or hover on a point of
|
|
|
7
7
|
<script type="module">
|
|
8
8
|
import '@brightspace-ui/core/components/button/button.js';
|
|
9
9
|
import '@brightspace-ui/core/components/tooltip/tooltip.js';
|
|
10
|
+
import '@brightspace-ui/core/components/tooltip/tooltip-help.js';
|
|
10
11
|
|
|
11
12
|
window.addEventListener('load', function () {
|
|
12
13
|
setTimeout(function() {
|
|
13
|
-
|
|
14
|
+
const tooltip = document.querySelector('#tooltip');
|
|
15
|
+
const helpTooltip = document.querySelector('#help-tooltip');
|
|
16
|
+
|
|
14
17
|
tooltip.showing = true;
|
|
18
|
+
helpTooltip.showing = true;
|
|
15
19
|
}, 20);
|
|
16
20
|
});
|
|
17
21
|
</script>
|
|
22
|
+
|
|
18
23
|
<d2l-button id="tooltip-button">Hover here</d2l-button>
|
|
19
24
|
<d2l-tooltip id="tooltip" for="tooltip-button">
|
|
20
25
|
Tooltip message example
|
|
21
26
|
</d2l-tooltip>
|
|
27
|
+
|
|
28
|
+
<d2l-tooltip-help id="help-tooltip" text="Hover here">
|
|
29
|
+
Tooltip message example
|
|
30
|
+
</d2l-tooltip-help>
|
|
22
31
|
```
|
|
23
32
|
|
|
33
|
+
Note: there is a [known defect](https://rally1.rallydev.com/#/?detail=/defect/641656338755&fdp=true) for tooltips, where they are sometimes rendered offset by some amount unexpectedly.
|
|
34
|
+
|
|
24
35
|
## Accessibility
|
|
25
36
|
|
|
26
37
|
**Interactive Target Elements:**
|
|
@@ -69,7 +80,16 @@ The `d2l-tooltip` component is used to display additional information when users
|
|
|
69
80
|
import '@brightspace-ui/core/components/inputs/input-text.js';
|
|
70
81
|
import '@brightspace-ui/core/components/tooltip/tooltip.js';
|
|
71
82
|
</script>
|
|
72
|
-
|
|
83
|
+
<!-- docs: start hidden content -->
|
|
84
|
+
<script>
|
|
85
|
+
window.addEventListener('load', function () {
|
|
86
|
+
setTimeout(function() {
|
|
87
|
+
const tooltip = document.querySelector('d2l-tooltip');
|
|
88
|
+
tooltip.showing = true;
|
|
89
|
+
}, 20);
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
<!-- docs: end hidden content -->
|
|
73
93
|
<d2l-input-text placeholder="Hover for Error" id="tooltip-error" aria-invalid="true" label="Text Input" label-hidden style="max-width:250px;"></d2l-input-text>
|
|
74
94
|
<d2l-tooltip for="tooltip-error" state="error">
|
|
75
95
|
Your error message will display here
|
|
@@ -121,6 +141,16 @@ In the following example to constrain the tooltip to the dashed boundary we can
|
|
|
121
141
|
import '@brightspace-ui/core/components/button/button.js';
|
|
122
142
|
import '@brightspace-ui/core/components/tooltip/tooltip.js';
|
|
123
143
|
</script>
|
|
144
|
+
<!-- docs: start hidden content -->
|
|
145
|
+
<script>
|
|
146
|
+
window.addEventListener('load', function () {
|
|
147
|
+
setTimeout(function() {
|
|
148
|
+
const tooltip = document.querySelector('d2l-tooltip');
|
|
149
|
+
tooltip.showing = true;
|
|
150
|
+
}, 20);
|
|
151
|
+
});
|
|
152
|
+
</script>
|
|
153
|
+
<!-- docs: end hidden content -->
|
|
124
154
|
<style>
|
|
125
155
|
.boundary {
|
|
126
156
|
border: 1px dashed #cdd5dc;
|
|
@@ -163,15 +193,24 @@ The `d2l-tooltip-help` component is used to display additional information when
|
|
|
163
193
|
<!-- docs: end donts -->
|
|
164
194
|
<!-- docs: end best practices -->
|
|
165
195
|
|
|
166
|
-
<!-- docs: demo live name:d2l-tooltip-help autoSize:false size:
|
|
196
|
+
<!-- docs: demo live name:d2l-tooltip-help autoSize:false size:medium -->
|
|
167
197
|
```html
|
|
168
198
|
<script type="module">
|
|
169
199
|
import '@brightspace-ui/core/components/tooltip/tooltip-help.js';
|
|
170
200
|
</script>
|
|
171
|
-
|
|
172
|
-
<
|
|
201
|
+
<!-- docs: start hidden content -->
|
|
202
|
+
<script>
|
|
203
|
+
window.addEventListener('load', function () {
|
|
204
|
+
setTimeout(function() {
|
|
205
|
+
const tooltip = document.querySelector('d2l-tooltip-help');
|
|
206
|
+
tooltip.showing = true;
|
|
207
|
+
}, 20);
|
|
208
|
+
});
|
|
209
|
+
</script>
|
|
210
|
+
<!-- docs: end hidden content -->
|
|
211
|
+
<p class="d2l-body-compact">
|
|
173
212
|
This is some sample text.
|
|
174
|
-
<d2l-tooltip-help text="Helpful label"
|
|
213
|
+
<d2l-tooltip-help text="Helpful label">Contents should elaborate on the label (be short and concise)</d2l-tooltip-help>
|
|
175
214
|
</p>
|
|
176
215
|
```
|
|
177
216
|
|
|
@@ -25,6 +25,10 @@ class TooltipHelp extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
|
25
25
|
* @type {'top'|'bottom'|'left'|'right'}
|
|
26
26
|
*/
|
|
27
27
|
position: { type: String },
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
showing: { type: Boolean, reflect: true },
|
|
28
32
|
/**
|
|
29
33
|
* REQUIRED: Text that will render as the Help Tooltip opener
|
|
30
34
|
* @type {string}
|
|
@@ -44,6 +48,7 @@ class TooltipHelp extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
|
44
48
|
#d2l-tooltip-help-text {
|
|
45
49
|
background: none;
|
|
46
50
|
border: none;
|
|
51
|
+
cursor: text;
|
|
47
52
|
padding: 0;
|
|
48
53
|
text-decoration-color: var(--d2l-color-galena);
|
|
49
54
|
text-decoration-line: underline;
|
|
@@ -75,6 +80,7 @@ class TooltipHelp extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
|
75
80
|
super();
|
|
76
81
|
|
|
77
82
|
this.inheritFontStyle = false;
|
|
83
|
+
this.showing = false;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
static get focusElementSelector() {
|
|
@@ -97,7 +103,7 @@ class TooltipHelp extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
|
97
103
|
<button id="d2l-tooltip-help-text" class="${classMap(classes)}">
|
|
98
104
|
${this.text}
|
|
99
105
|
</button>
|
|
100
|
-
<d2l-tooltip for="d2l-tooltip-help-text" delay="0" offset="13" position="${ifDefined(this.position)}">
|
|
106
|
+
<d2l-tooltip for="d2l-tooltip-help-text" delay="0" offset="13" position="${ifDefined(this.position)}" ?showing="${this.showing}">
|
|
101
107
|
<slot></slot>
|
|
102
108
|
</d2l-tooltip>
|
|
103
109
|
`;
|
package/custom-elements.json
CHANGED
|
@@ -10049,6 +10049,11 @@
|
|
|
10049
10049
|
"description": "Allows this component to inherit certain font properties",
|
|
10050
10050
|
"type": "boolean",
|
|
10051
10051
|
"default": "false"
|
|
10052
|
+
},
|
|
10053
|
+
{
|
|
10054
|
+
"name": "showing",
|
|
10055
|
+
"type": "boolean",
|
|
10056
|
+
"default": "false"
|
|
10052
10057
|
}
|
|
10053
10058
|
],
|
|
10054
10059
|
"slots": [
|
package/helpers/mathjax.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const mathjaxContextAttribute = 'data-mathjax-context';
|
|
7
|
-
const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.2
|
|
7
|
+
const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.1.2';
|
|
8
8
|
|
|
9
9
|
const mathjaxFontMappings = new Map([
|
|
10
10
|
['MJXTEX', 'MathJax_Main-Regular'],
|
|
@@ -50,7 +50,7 @@ export class HtmlBlockMathRenderer {
|
|
|
50
50
|
|
|
51
51
|
const mathJaxConfig = {
|
|
52
52
|
deferTypeset: true,
|
|
53
|
-
renderLatex: isLatexSupported
|
|
53
|
+
renderLatex: isLatexSupported,
|
|
54
54
|
outputScale: context.outputScale || 1
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -60,25 +60,32 @@ export class HtmlBlockMathRenderer {
|
|
|
60
60
|
// This work-around should be removed when linebreaks are natively supported.
|
|
61
61
|
// MathJax issue: https://github.com/mathjax/MathJax/issues/2312
|
|
62
62
|
// A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const lineBreakStyle = 'display: block; height: 0.5rem;';
|
|
64
|
+
|
|
65
|
+
// If we're opting out of deferred rendering, we need to rely
|
|
66
|
+
// on the global MathJax install for rendering.
|
|
67
|
+
if (options.noDeferredRendering) {
|
|
68
|
+
elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
|
|
69
|
+
elm.setAttribute('style', lineBreakStyle);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
await window.MathJax.startup.promise;
|
|
73
|
+
window.MathJax.typesetShadow(elem.getRootNode(), elem);
|
|
74
|
+
return elem;
|
|
75
|
+
}
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
// on the global MathJax styles for rendering.
|
|
72
|
-
if (options.noDeferredRendering) return elem;
|
|
77
|
+
const inner = elem.innerHTML.replace(/<mspace linebreak="newline">/gi, `<mspace linebreak="newline" style="${lineBreakStyle}">`);
|
|
73
78
|
|
|
74
|
-
const
|
|
75
|
-
|
|
79
|
+
const temp = document.createElement('div');
|
|
80
|
+
temp.style.display = 'none';
|
|
81
|
+
temp.attachShadow({ mode: 'open' });
|
|
82
|
+
temp.shadowRoot.innerHTML = `<div><mjx-doc><mjx-head></mjx-head><mjx-body>${inner}</mjx-body></mjx-doc></div>`;
|
|
76
83
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
elem.appendChild(temp);
|
|
85
|
+
await window.MathJax.startup.promise;
|
|
86
|
+
window.MathJax.typesetShadow(temp.shadowRoot);
|
|
80
87
|
|
|
81
|
-
return
|
|
88
|
+
return temp.shadowRoot.firstChild;
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
}
|
|
@@ -94,7 +101,6 @@ export function loadMathJax(mathJaxConfig) {
|
|
|
94
101
|
|
|
95
102
|
window.MathJax = {
|
|
96
103
|
chtml: {
|
|
97
|
-
adaptiveCSS: false,
|
|
98
104
|
scale: (mathJaxConfig && mathJaxConfig.outputScale) || 1
|
|
99
105
|
},
|
|
100
106
|
options: {
|
|
@@ -104,6 +110,100 @@ export function loadMathJax(mathJaxConfig) {
|
|
|
104
110
|
},
|
|
105
111
|
loader: { load: loadOptions },
|
|
106
112
|
startup: {
|
|
113
|
+
ready: () => {
|
|
114
|
+
|
|
115
|
+
// Setup for using MathJax for typesetting math in shadowDOM
|
|
116
|
+
// https://github.com/mathjax/MathJax/issues/2195
|
|
117
|
+
|
|
118
|
+
//
|
|
119
|
+
// Get some MathJax objects from the MathJax global
|
|
120
|
+
//
|
|
121
|
+
// (Ideally, you would turn this into a custom component, and
|
|
122
|
+
// then these could be handled by normal imports, but this is
|
|
123
|
+
// just an example and so we use an expedient method of
|
|
124
|
+
// accessing these for now.)
|
|
125
|
+
//
|
|
126
|
+
const mathjax = window.MathJax._.mathjax.mathjax;
|
|
127
|
+
const HTMLAdaptor = window.MathJax._.adaptors.HTMLAdaptor.HTMLAdaptor;
|
|
128
|
+
const HTMLHandler = window.MathJax._.handlers.html.HTMLHandler.HTMLHandler;
|
|
129
|
+
const AbstractHandler = window.MathJax._.core.Handler.AbstractHandler.prototype;
|
|
130
|
+
const startup = window.MathJax.startup;
|
|
131
|
+
|
|
132
|
+
//
|
|
133
|
+
// Extend HTMLAdaptor to handle shadowDOM as the document
|
|
134
|
+
//
|
|
135
|
+
class ShadowAdaptor extends HTMLAdaptor {
|
|
136
|
+
body(doc) {
|
|
137
|
+
return doc.body || (doc.firstChild || {}).lastChild || doc;
|
|
138
|
+
}
|
|
139
|
+
create(kind, ns) {
|
|
140
|
+
const document = (this.document.createElement ? this.document : this.window.document);
|
|
141
|
+
return (ns ?
|
|
142
|
+
document.createElementNS(ns, kind) :
|
|
143
|
+
document.createElement(kind));
|
|
144
|
+
}
|
|
145
|
+
head(doc) {
|
|
146
|
+
return doc.head || (doc.firstChild || {}).firstChild || doc;
|
|
147
|
+
}
|
|
148
|
+
root(doc) {
|
|
149
|
+
return doc.documentElement || doc.firstChild || doc;
|
|
150
|
+
}
|
|
151
|
+
text(text) {
|
|
152
|
+
const document = (this.document.createTextNode ? this.document : this.window.document);
|
|
153
|
+
return document.createTextNode(text);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//
|
|
158
|
+
// Extend HTMLHandler to handle shadowDOM as document
|
|
159
|
+
//
|
|
160
|
+
class ShadowHandler extends HTMLHandler {
|
|
161
|
+
create(document, options) {
|
|
162
|
+
const adaptor = this.adaptor;
|
|
163
|
+
if (typeof(document) === 'string') {
|
|
164
|
+
document = adaptor.parse(document, 'text/html');
|
|
165
|
+
} else if ((document instanceof adaptor.window.HTMLElement || document instanceof adaptor.window.DocumentFragment) && !(document instanceof window.ShadowRoot)) {
|
|
166
|
+
const child = document;
|
|
167
|
+
document = adaptor.parse('', 'text/html');
|
|
168
|
+
adaptor.append(adaptor.body(document), child);
|
|
169
|
+
}
|
|
170
|
+
//
|
|
171
|
+
// We can't use super.create() here, since that doesn't
|
|
172
|
+
// handle shadowDOM correctly, so call HTMLHandler's parent class
|
|
173
|
+
// directly instead.
|
|
174
|
+
//
|
|
175
|
+
return AbstractHandler.create.call(this, document, options);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
//
|
|
180
|
+
// Register the new handler and adaptor
|
|
181
|
+
//
|
|
182
|
+
startup.registerConstructor('HTMLHandler', ShadowHandler);
|
|
183
|
+
startup.registerConstructor('browserAdaptor', () => new ShadowAdaptor(window));
|
|
184
|
+
|
|
185
|
+
//
|
|
186
|
+
// A service function that creates a new MathDocument from the
|
|
187
|
+
// shadow root with the configured input and output jax, and then
|
|
188
|
+
// renders the document. The MathDocument is returned in case
|
|
189
|
+
// you need to rerender the shadowRoot later.
|
|
190
|
+
//
|
|
191
|
+
window.MathJax.typesetShadow = function(root, elem) {
|
|
192
|
+
const InputJax = startup.getInputJax();
|
|
193
|
+
const OutputJax = startup.getOutputJax();
|
|
194
|
+
const html = mathjax.document(root, { InputJax, OutputJax });
|
|
195
|
+
|
|
196
|
+
if (elem) html.options.elements = [elem];
|
|
197
|
+
|
|
198
|
+
html.render().typeset();
|
|
199
|
+
return html;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
//
|
|
203
|
+
// Now do the usual startup now that the extensions are in place
|
|
204
|
+
//
|
|
205
|
+
window.MathJax.startup.defaultReady();
|
|
206
|
+
},
|
|
107
207
|
// Defer typesetting if the config is present and deferring is set
|
|
108
208
|
typeset: !(mathJaxConfig && mathJaxConfig.deferTypeset)
|
|
109
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.4",
|
|
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",
|