@brightspace-ui/core 2.0.4 → 2.1.2
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.
|
@@ -124,7 +124,12 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
resize() {
|
|
127
|
-
return
|
|
127
|
+
return new Promise(resolve => {
|
|
128
|
+
setTimeout(async() => {
|
|
129
|
+
await this._updateSize();
|
|
130
|
+
resolve();
|
|
131
|
+
}, 0);
|
|
132
|
+
});
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
_addHandlers() {
|
|
@@ -330,7 +335,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
330
335
|
// focus first focusable child prior to auto resize (fixes screen reader hiccups)
|
|
331
336
|
this._focusInitial();
|
|
332
337
|
|
|
333
|
-
|
|
338
|
+
setTimeout(async() => {
|
|
334
339
|
|
|
335
340
|
this.shadowRoot.querySelector('.d2l-dialog-content').scrollTop = 0;
|
|
336
341
|
// scrollbar is kept hidden while we update the scroll position to avoid scrollbar flash
|
|
@@ -340,6 +345,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
340
345
|
|
|
341
346
|
await this._updateSize();
|
|
342
347
|
this._state = 'showing';
|
|
348
|
+
await this._updateComplete;
|
|
343
349
|
|
|
344
350
|
// edge case: no children were focused, try again after one redraw
|
|
345
351
|
const activeElement = getComposedActiveElement();
|
|
@@ -354,7 +360,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
|
354
360
|
this.dispatchEvent(new CustomEvent(
|
|
355
361
|
'd2l-dialog-open', { bubbles: true, composed: true }
|
|
356
362
|
));
|
|
357
|
-
});
|
|
363
|
+
}, 0);
|
|
358
364
|
|
|
359
365
|
}
|
|
360
366
|
|
|
@@ -11,6 +11,15 @@ export const dialogStyles = css`
|
|
|
11
11
|
display: block;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
:host([opened]:not([_state="showing"])) {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([opened][_state="showing"]),
|
|
19
|
+
:host([opened][_state="hiding"]) {
|
|
20
|
+
visibility: visible;
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
.d2l-dialog-outer {
|
|
15
24
|
background-color: white;
|
|
16
25
|
border: 1px solid var(--d2l-color-mica);
|
|
@@ -71,6 +71,7 @@ export const TabPanelMixin = superclass => class extends superclass {
|
|
|
71
71
|
}
|
|
72
72
|
} else if (prop === 'text') {
|
|
73
73
|
this.setAttribute('aria-label', this.text);
|
|
74
|
+
/** Dispatched when the text attribute is changed */
|
|
74
75
|
this.dispatchEvent(new CustomEvent(
|
|
75
76
|
'd2l-tab-panel-text-changed', { bubbles: true, composed: true, detail: { text: this.text } }
|
|
76
77
|
));
|
package/custom-elements.json
CHANGED
|
@@ -9707,7 +9707,8 @@
|
|
|
9707
9707
|
"description": "Dispatched when a tab is selected"
|
|
9708
9708
|
},
|
|
9709
9709
|
{
|
|
9710
|
-
"name": "d2l-tab-panel-text-changed"
|
|
9710
|
+
"name": "d2l-tab-panel-text-changed",
|
|
9711
|
+
"description": "Dispatched when the text attribute is changed"
|
|
9711
9712
|
}
|
|
9712
9713
|
],
|
|
9713
9714
|
"slots": [
|
|
@@ -2,11 +2,17 @@ import { getLocalizeOverrideResources } from '../helpers/getLocalizeResources.js
|
|
|
2
2
|
import { LocalizeMixin } from './localize-mixin.js';
|
|
3
3
|
|
|
4
4
|
const fallbackLang = 'en';
|
|
5
|
+
const supportedLangpacks = ['ar', 'cy', 'da', 'de', 'en', 'es', 'es-es', 'fr', 'fr-fr', 'fr-on', 'hi', 'ja', 'ko', 'nl', 'pt', 'sv', 'tr', 'zh-cn', 'zh-tw'];
|
|
5
6
|
|
|
6
7
|
export const LocalizeDynamicMixin = superclass => class extends LocalizeMixin(superclass) {
|
|
7
8
|
|
|
8
9
|
static async getLocalizeResources(langs, { importFunc, osloCollection }) {
|
|
9
10
|
|
|
11
|
+
// in dev, don't request unsupported langpacks
|
|
12
|
+
if (!importFunc.toString().includes('switch')) {
|
|
13
|
+
langs = langs.filter(lang => supportedLangpacks.includes(lang));
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
for (const lang of [...langs, fallbackLang]) {
|
|
11
17
|
|
|
12
18
|
const resources = await importFunc(lang).catch(() => {});
|
package/mixins/localize-mixin.md
CHANGED
|
@@ -83,7 +83,9 @@ class MyComponent extends LocalizeDynamicMixin(LitElement) {
|
|
|
83
83
|
}
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
When using this method, depending on various user settings, it's possible that a language file that does not exist will be requested, resulting in a network error (404). In production, your build system should prevent this by transpiling the variable dynamic import into a `switch` statement.
|
|
87
|
+
|
|
88
|
+
If your build system does not support variable dynamic imports, you'll need to manually set up imports for each supported language:
|
|
87
89
|
|
|
88
90
|
```javascript
|
|
89
91
|
static get localizeConfig() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
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",
|