@brightspace-ui/core 2.0.0 → 2.0.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.
@@ -30,11 +30,7 @@ class CodeView extends LitElement {
30
30
  if (Prism.languages[language]) {
31
31
  this._dependenciesPromise = Promise.resolve();
32
32
  } else {
33
- /* Current, non-relative imports don't appear to work with Polymer dev server
34
- for FF, Edge, IE11. Use of non-default languages is limited to dev with this approach.
35
- https://github.com/Polymer/tools/issues/3402 */
36
- const path = `/node_modules/prismjs/components/prism-${language}.min.js`;
37
- this._dependenciesPromise = import(path);
33
+ this._dependenciesPromise = import(`./node_modules/prismjs/components/prism-${language}.min.js`);
38
34
  }
39
35
  if (this.shadowRoot) this._updateCode(this.shadowRoot.querySelector('slot'));
40
36
  super.attributeChangedCallback(name, oldval, newval);
@@ -51,17 +51,6 @@ export const TabPanelMixin = superclass => class extends superclass {
51
51
  this.selected = false;
52
52
  }
53
53
 
54
- async attributeChangedCallback(name, oldval, newval) {
55
- super.attributeChangedCallback(name, oldval, newval);
56
- if (name === 'text') {
57
- this.setAttribute('aria-label', this.text);
58
- /** Dispatched when the text attribute is changed */
59
- this.dispatchEvent(new CustomEvent(
60
- 'd2l-tab-panel-text-changed', { bubbles: true, composed: true, detail: { text: this.text } }
61
- ));
62
- }
63
- }
64
-
65
54
  connectedCallback() {
66
55
  super.connectedCallback();
67
56
  if (this.id.length === 0) this.id = getUniqueId();
@@ -80,6 +69,11 @@ export const TabPanelMixin = superclass => class extends superclass {
80
69
  ));
81
70
  });
82
71
  }
72
+ } else if (prop === 'text') {
73
+ this.setAttribute('aria-label', this.text);
74
+ this.dispatchEvent(new CustomEvent(
75
+ 'd2l-tab-panel-text-changed', { bubbles: true, composed: true, detail: { text: this.text } }
76
+ ));
83
77
  }
84
78
  });
85
79
  }
@@ -9702,13 +9702,12 @@
9702
9702
  }
9703
9703
  ],
9704
9704
  "events": [
9705
- {
9706
- "name": "d2l-tab-panel-text-changed",
9707
- "description": "Dispatched when the text attribute is changed"
9708
- },
9709
9705
  {
9710
9706
  "name": "d2l-tab-panel-selected",
9711
9707
  "description": "Dispatched when a tab is selected"
9708
+ },
9709
+ {
9710
+ "name": "d2l-tab-panel-text-changed"
9712
9711
  }
9713
9712
  ],
9714
9713
  "slots": [
@@ -12,14 +12,14 @@ If the elements are known up-front and are in the element's local DOM scope, sim
12
12
  import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
13
13
  class MyElement extends ArrowKeysMixin(LitElement) {
14
14
  render() {
15
- return html`
15
+ return this.arrowKeysContainer(html`
16
16
  <div>
17
17
  ...
18
18
  <a href="..." class="d2l-arrowkeys-focusable">link 1</a>
19
19
  <a href="..." class="d2l-arrowkeys-focusable">link 2</a>
20
20
  ...
21
21
  </div>
22
- `;
22
+ `);
23
23
  }
24
24
  }
25
25
  customElements.define('my-element', MyElement);
@@ -31,14 +31,14 @@ If the elements are not known up front, or the elements cannot be simply queried
31
31
  import { ArrowKeysMixin } from '@brightspace-ui/core/mixins/arrow-keys-mixin.js';
32
32
  class MyElement extends ArrowKeysMixin(LitElement) {
33
33
  render() {
34
- return html`
34
+ return this.arrowKeysContainer(html`
35
35
  <div>
36
36
  ...
37
37
  <a href="...">link 1</a>
38
38
  <a href="...">link 2</a>
39
39
  ...
40
40
  </div>
41
- `;
41
+ `);
42
42
  }
43
43
  async arrowKeysFocusablesProvider() {
44
44
  return [ /* array containing focusable elements */]
@@ -51,4 +51,8 @@ customElements.define('my-element', MyElement);
51
51
 
52
52
  - `arrowKeysDirection` (String): Indicates which arrow keys are allowed (default is leftright)
53
53
  - `arrowKeysNoWrap` (Boolean): Whether focus should wrap from end-to-start and start-to-end
54
- - `arrowKeysBeforeFocus` (Function): Async callback invoked before focus us applied
54
+
55
+ **Methods:**
56
+ - `arrowKeysContainer(innerHtmlTemplate)`: Hooks up the event listener, to be used in your `render` function to wrap the focusable elements
57
+ - `async arrowKeysFocusablesProvider()` (Array): Optional - Override to provide the focusable elements if necessary (see above)
58
+ - `async arrowKeysOnBeforeFocus(elemToBeFocused)`: Optional - Override to provide an async callback invoked before focus is applied
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.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",