@brightspace-ui/core 2.14.4 → 2.14.7
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.
|
@@ -111,9 +111,6 @@ export const htmlBlockContentStyles = css`
|
|
|
111
111
|
mjx-assistive-mml math {
|
|
112
112
|
position: absolute;
|
|
113
113
|
}
|
|
114
|
-
:host([dir="rtl"]) {
|
|
115
|
-
text-align: right;
|
|
116
|
-
}
|
|
117
114
|
`;
|
|
118
115
|
|
|
119
116
|
let renderers;
|
|
@@ -164,6 +161,9 @@ class HtmlBlock extends RtlMixin(LitElement) {
|
|
|
164
161
|
:host([no-deferred-rendering]) div.d2l-html-block-rendered {
|
|
165
162
|
display: none;
|
|
166
163
|
}
|
|
164
|
+
:host([dir="rtl"]) {
|
|
165
|
+
text-align: right;
|
|
166
|
+
}
|
|
167
167
|
`];
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -31,6 +31,7 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
31
31
|
* @type {boolean}
|
|
32
32
|
*/
|
|
33
33
|
selectAllPagesAllowed: { type: Boolean, attribute: 'select-all-pages-allowed' },
|
|
34
|
+
_hasActions: { state: true },
|
|
34
35
|
_scrolled: { type: Boolean, reflect: true }
|
|
35
36
|
};
|
|
36
37
|
}
|
|
@@ -60,6 +61,7 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
60
61
|
height: 40px;
|
|
61
62
|
position: absolute;
|
|
62
63
|
width: 100%;
|
|
64
|
+
z-index: -1;
|
|
63
65
|
}
|
|
64
66
|
:host([hidden]) {
|
|
65
67
|
display: none;
|
|
@@ -69,6 +71,9 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
69
71
|
display: flex;
|
|
70
72
|
margin-bottom: 6px;
|
|
71
73
|
margin-top: 6px;
|
|
74
|
+
min-height: 54px;
|
|
75
|
+
}
|
|
76
|
+
.d2l-list-header-container-slim {
|
|
72
77
|
min-height: 36px;
|
|
73
78
|
}
|
|
74
79
|
.d2l-list-header-extend-separator {
|
|
@@ -124,6 +129,7 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
124
129
|
render() {
|
|
125
130
|
const classes = {
|
|
126
131
|
'd2l-list-header-container': true,
|
|
132
|
+
'd2l-list-header-container-slim': (!this._hasActions && !this.selectAllPagesAllowed),
|
|
127
133
|
'd2l-list-header-extend-separator': this._extendSeparator
|
|
128
134
|
};
|
|
129
135
|
return html`
|
|
@@ -138,13 +144,17 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
|
|
|
138
144
|
${this.selectAllPagesAllowed ? html`<d2l-selection-select-all-pages></d2l-selection-select-all-pages>` : null}
|
|
139
145
|
`}
|
|
140
146
|
<div class="d2l-list-header-actions">
|
|
141
|
-
<d2l-overflow-group opener-type="icon"><slot></slot></d2l-overflow-group>
|
|
147
|
+
<d2l-overflow-group opener-type="icon"><slot @slotchange="${this._handleSlotChange}"></slot></d2l-overflow-group>
|
|
142
148
|
</div>
|
|
143
149
|
</div>
|
|
144
150
|
${!this.noSticky ? html`<div class="d2l-list-header-shadow"></div>` : null}
|
|
145
151
|
`;
|
|
146
152
|
}
|
|
147
153
|
|
|
154
|
+
_handleSlotChange(e) {
|
|
155
|
+
this._hasActions = (e.target.assignedNodes({ flatten: true }).filter(node => node.nodeType === Node.ELEMENT_NODE).length > 0);
|
|
156
|
+
}
|
|
157
|
+
|
|
148
158
|
}
|
|
149
159
|
|
|
150
160
|
customElements.define('d2l-list-header', ListHeader);
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
<h2>Tag List with Interactive</h2>
|
|
75
75
|
<d2l-demo-snippet fullscreen>
|
|
76
|
-
<div
|
|
76
|
+
<div grid>
|
|
77
77
|
<d2l-tag-list description="A bunch of example tags" clearable>
|
|
78
78
|
<d2l-tag-list-item text="Example Tag"></d2l-tag-list-item>
|
|
79
79
|
<d2l-tag-list-item text="Longer Example Tag - much much much much much longer"></d2l-tag-list-item>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { css, html } from 'lit';
|
|
2
2
|
import { findComposedAncestor, isComposedAncestor } from '../helpers/dom.js';
|
|
3
|
-
import {
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { getNextFocusable } from '../helpers/focus.js';
|
|
4
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
6
|
import { LocalizeCoreElement } from '../helpers/localize-core-element.js';
|
|
7
|
+
import { offscreenStyles } from '../components/offscreen/offscreen.js';
|
|
6
8
|
|
|
7
9
|
const keyCodes = {
|
|
8
10
|
ENTER: 13,
|
|
@@ -13,24 +15,25 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
|
13
15
|
|
|
14
16
|
static get properties() {
|
|
15
17
|
return {
|
|
18
|
+
_focusingToggle: { state: true },
|
|
16
19
|
_hasInteractiveAncestor: { state: true },
|
|
17
20
|
_interactive: { state: true }
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
static get styles() {
|
|
22
|
-
return css`
|
|
23
|
-
.interactive-
|
|
24
|
-
.interactive-container:focus-visible {
|
|
25
|
+
return [offscreenStyles, css`
|
|
26
|
+
.interactive-focusing-toggle {
|
|
25
27
|
border-radius: 6px;
|
|
26
28
|
outline: 2px solid var(--d2l-color-celestine);
|
|
27
29
|
outline-offset: 2px;
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
`];
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
constructor() {
|
|
33
35
|
super();
|
|
36
|
+
this._focusingToggle = false;
|
|
34
37
|
this._hasInteractiveAncestor = false;
|
|
35
38
|
this._interactive = false;
|
|
36
39
|
}
|
|
@@ -39,14 +42,14 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
|
39
42
|
super.connectedCallback();
|
|
40
43
|
|
|
41
44
|
const parentGrid = findComposedAncestor(this.parentNode, node => {
|
|
42
|
-
return (
|
|
45
|
+
return (node.nodeType === Node.ELEMENT_NODE && (node.hasAttribute('grid') || node.getAttribute('role') === 'grid'));
|
|
43
46
|
});
|
|
44
47
|
this._hasInteractiveAncestor = (parentGrid !== null);
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
focus() {
|
|
48
51
|
if (!this.shadowRoot) return;
|
|
49
|
-
if (this._hasInteractiveAncestor && !this._interactive)
|
|
52
|
+
if (this._hasInteractiveAncestor && !this._interactive) this.shadowRoot.querySelector('.interactive-toggle').focus();
|
|
50
53
|
else this._focusDelegate();
|
|
51
54
|
}
|
|
52
55
|
|
|
@@ -57,18 +60,27 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
|
57
60
|
if (!focusDelegate) {
|
|
58
61
|
throw new Error(`InteractiveMixin: no focus delegate provided for "${this.tagName}"`);
|
|
59
62
|
}
|
|
63
|
+
|
|
60
64
|
this._focusDelegate = focusDelegate;
|
|
61
65
|
if (!this._hasInteractiveAncestor) return inner;
|
|
66
|
+
|
|
67
|
+
const classes = {
|
|
68
|
+
'interactive-focusing-toggle': this._focusingToggle
|
|
69
|
+
};
|
|
70
|
+
|
|
62
71
|
return html`
|
|
63
|
-
<div class="
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
<div class="${classMap(classes)}" @keydown="${this._handleInteractiveKeyDown}">
|
|
73
|
+
<button
|
|
74
|
+
class="interactive-toggle d2l-offscreen"
|
|
75
|
+
@blur="${this._handleInteractiveToggleBlur}"
|
|
76
|
+
@click="${this._handleInteractiveToggleClick}"
|
|
77
|
+
@focus="${this._handleInteractiveToggleFocus}"
|
|
78
|
+
tabindex="${ifDefined(this._hasInteractiveAncestor && !this._interactive ? '0' : '-1')}">
|
|
79
|
+
${`${label}, ${this.localize('components.interactive.instructions')}`}
|
|
80
|
+
</button>
|
|
81
|
+
<span class="interactive-trap-start" @focus="${this._handleInteractiveTrapStartFocus}" tabindex="${ifDefined(this._hasInteractiveAncestor ? '0' : undefined)}"></span>
|
|
70
82
|
<div class="interactive-container-content" @focusin="${this._handleInteractiveContentFocusIn}" @focusout="${this._handleInteractiveContentFocusOut}">${inner}</div>
|
|
71
|
-
<span class="interactive-trap-end" @focus="${this.
|
|
83
|
+
<span class="interactive-trap-end" @focus="${this._handleInteractiveTrapEndFocus}" tabindex="${ifDefined(this._hasInteractiveAncestor ? '0' : undefined)}"></span>
|
|
72
84
|
</div>
|
|
73
85
|
`;
|
|
74
86
|
}
|
|
@@ -83,27 +95,37 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
|
83
95
|
this._interactive = false;
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
async _handleInteractiveEndFocus() {
|
|
87
|
-
// focus moved to trap-end either forwards from contents or backwards from outside - focus interactive toggle
|
|
88
|
-
this._interactive = false;
|
|
89
|
-
await this.updateComplete;
|
|
90
|
-
this.shadowRoot.querySelector('.interactive-container').focus();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
98
|
async _handleInteractiveKeyDown(e) {
|
|
94
|
-
if (
|
|
95
|
-
this._interactive = true;
|
|
96
|
-
await this.updateComplete;
|
|
97
|
-
this.focus();
|
|
98
|
-
} else if (this._interactive && e.keyCode === keyCodes.ESCAPE) {
|
|
99
|
+
if (this._interactive && e.keyCode === keyCodes.ESCAPE) {
|
|
99
100
|
this._interactive = false;
|
|
100
101
|
await this.updateComplete;
|
|
101
|
-
this.shadowRoot.querySelector('.interactive-
|
|
102
|
+
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
_handleInteractiveToggleBlur() {
|
|
107
|
+
this._focusingToggle = false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async _handleInteractiveToggleClick() {
|
|
111
|
+
this._interactive = true;
|
|
112
|
+
await this.updateComplete;
|
|
113
|
+
this.focus();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_handleInteractiveToggleFocus() {
|
|
117
|
+
this._focusingToggle = true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async _handleInteractiveTrapEndFocus() {
|
|
121
|
+
// focus moved to trap-end either forwards from contents or backwards from outside - focus interactive toggle
|
|
122
|
+
this._interactive = false;
|
|
123
|
+
await this.updateComplete;
|
|
124
|
+
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async _handleInteractiveTrapStartFocus(e) {
|
|
128
|
+
if (e.relatedTarget === this.shadowRoot.querySelector('.interactive-toggle')) {
|
|
107
129
|
// focus moved to trap-start while non-interactive - focus next focusable after this component
|
|
108
130
|
const nextFocusable = getNextFocusable(this.shadowRoot.querySelector('.interactive-trap-end'));
|
|
109
131
|
if (nextFocusable) nextFocusable.focus();
|
|
@@ -111,7 +133,7 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
|
111
133
|
// focus moved to trap-start backwards from within contents - toggle to non-interactive and apply focus
|
|
112
134
|
this._interactive = false;
|
|
113
135
|
await this.updateComplete;
|
|
114
|
-
this.shadowRoot.querySelector('.interactive-
|
|
136
|
+
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
|
115
137
|
}
|
|
116
138
|
}
|
|
117
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.7",
|
|
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",
|