@brightspace-ui/core 3.11.0 → 3.13.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.
@@ -8,6 +8,7 @@ import '../dropdown/dropdown-menu.js';
|
|
8
8
|
import '../empty-state/empty-state-action-button.js';
|
9
9
|
import '../empty-state/empty-state-action-link.js';
|
10
10
|
import '../empty-state/empty-state-simple.js';
|
11
|
+
import '../expand-collapse/expand-collapse-content.js';
|
11
12
|
import '../hierarchical-view/hierarchical-view.js';
|
12
13
|
import '../inputs/input-search.js';
|
13
14
|
import '../list/list.js';
|
@@ -132,12 +133,20 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
132
133
|
}
|
133
134
|
|
134
135
|
.d2l-filter-dimension-set-value {
|
136
|
+
align-items: center;
|
135
137
|
color: var(--d2l-color-ferrite);
|
136
138
|
display: flex;
|
137
139
|
gap: 0.45rem;
|
138
140
|
line-height: unset;
|
139
141
|
overflow: hidden;
|
140
142
|
}
|
143
|
+
.d2l-filter-dimension-set-value d2l-icon {
|
144
|
+
flex-shrink: 0;
|
145
|
+
}
|
146
|
+
d2l-expand-collapse-content[expanded] {
|
147
|
+
padding-block: 0.5rem;
|
148
|
+
padding-inline: 0.2rem;
|
149
|
+
}
|
141
150
|
|
142
151
|
.d2l-filter-dimension-set-value-text {
|
143
152
|
-webkit-box-orient: vertical;
|
@@ -577,11 +586,22 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
|
|
577
586
|
?hidden="${item.hidden}"
|
578
587
|
key="${item.key}"
|
579
588
|
label="${item.text}"
|
589
|
+
?no-primary-action="${item.additionalContent && item.selected}"
|
580
590
|
selectable
|
581
591
|
?selected="${item.selected}">
|
582
|
-
<div
|
583
|
-
<div class="d2l-filter-dimension-set-value-
|
584
|
-
|
592
|
+
<div>
|
593
|
+
<div class="d2l-filter-dimension-set-value d2l-body-compact">
|
594
|
+
<div class="d2l-filter-dimension-set-value-text">${item.text}</div>
|
595
|
+
${item.count !== undefined ? html`<div class="d2l-body-small">(${formatNumber(item.count)})</div>` : nothing}
|
596
|
+
${item.additionalContent
|
597
|
+
? html`<d2l-icon icon="${item.selected ? 'tier1:arrow-collapse-small' : 'tier1:arrow-expand-small'}"></d2l-icon>`
|
598
|
+
: nothing}
|
599
|
+
</div>
|
600
|
+
${item.additionalContent ? html`
|
601
|
+
<d2l-expand-collapse-content ?expanded="${item.selected}">
|
602
|
+
${item.additionalContent()}
|
603
|
+
</d2l-expand-collapse-content>
|
604
|
+
` : nothing}
|
585
605
|
</div>
|
586
606
|
</d2l-list-item>
|
587
607
|
`;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { clearDismissible, setDismissible } from '../../helpers/dismissible.js';
|
1
2
|
import { css, html } from 'lit';
|
2
3
|
import { findComposedAncestor, isComposedAncestor } from '../../helpers/dom.js';
|
3
4
|
import { classMap } from 'lit/directives/class-map.js';
|
@@ -7,11 +8,6 @@ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
7
8
|
import { offscreenStyles } from '../../components/offscreen/offscreen.js';
|
8
9
|
import { RtlMixin } from '../rtl/rtl-mixin.js';
|
9
10
|
|
10
|
-
const keyCodes = {
|
11
|
-
ENTER: 13,
|
12
|
-
ESCAPE: 27
|
13
|
-
};
|
14
|
-
|
15
11
|
export function isInteractiveDescendant(node) {
|
16
12
|
if (!node) return false;
|
17
13
|
return !!findComposedAncestor(node, node => {
|
@@ -41,6 +37,7 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
41
37
|
|
42
38
|
constructor() {
|
43
39
|
super();
|
40
|
+
this._dismissibleId = null;
|
44
41
|
this._focusingToggle = false;
|
45
42
|
this._hasInteractiveAncestor = false;
|
46
43
|
this._interactive = false;
|
@@ -55,6 +52,14 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
55
52
|
this._hasInteractiveAncestor = (parentGrid !== null);
|
56
53
|
}
|
57
54
|
|
55
|
+
disconnectedCallback() {
|
56
|
+
super.disconnectedCallback();
|
57
|
+
|
58
|
+
if (!this._dismissibleId) return;
|
59
|
+
clearDismissible(this._dismissibleId);
|
60
|
+
this._dismissibleId = null;
|
61
|
+
}
|
62
|
+
|
58
63
|
focus() {
|
59
64
|
if (!this.shadowRoot) return;
|
60
65
|
if (this._hasInteractiveAncestor && !this._interactive) this.shadowRoot.querySelector('.interactive-toggle').focus();
|
@@ -97,20 +102,29 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
97
102
|
|
98
103
|
_handleInteractiveContentFocusIn() {
|
99
104
|
this._interactive = true;
|
105
|
+
this._dismissibleId = setDismissible(async() => {
|
106
|
+
await this._handleInteractiveExit();
|
107
|
+
});
|
100
108
|
}
|
101
109
|
|
102
110
|
_handleInteractiveContentFocusOut(e) {
|
103
111
|
if (isComposedAncestor(this.shadowRoot.querySelector('.interactive-container-content'), e.relatedTarget)) return;
|
104
112
|
// focus moved out of the interactive content
|
105
113
|
this._interactive = false;
|
114
|
+
if (this._dismissibleId) {
|
115
|
+
clearDismissible(this._dismissibleId);
|
116
|
+
this._dismissibleId = null;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
async _handleInteractiveExit() {
|
121
|
+
this._interactive = false;
|
122
|
+
await this.updateComplete;
|
123
|
+
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
106
124
|
}
|
107
125
|
|
108
126
|
async _handleInteractiveKeyDown(e) {
|
109
|
-
if (this._interactive && e.keyCode ===
|
110
|
-
this._interactive = false;
|
111
|
-
await this.updateComplete;
|
112
|
-
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
113
|
-
}
|
127
|
+
if (this._interactive && e.keyCode === 9) e.stopPropagation(); // tab
|
114
128
|
}
|
115
129
|
|
116
130
|
_handleInteractiveToggleBlur() {
|
@@ -129,9 +143,7 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
129
143
|
|
130
144
|
async _handleInteractiveTrapEndFocus() {
|
131
145
|
// focus moved to trap-end either forwards from contents or backwards from outside - focus interactive toggle
|
132
|
-
this.
|
133
|
-
await this.updateComplete;
|
134
|
-
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
146
|
+
await this._handleInteractiveExit();
|
135
147
|
}
|
136
148
|
|
137
149
|
async _handleInteractiveTrapStartFocus(e) {
|
@@ -141,9 +153,7 @@ export const InteractiveMixin = superclass => class extends LocalizeCoreElement(
|
|
141
153
|
if (nextFocusable) nextFocusable.focus();
|
142
154
|
} else {
|
143
155
|
// focus moved to trap-start backwards from within contents - toggle to non-interactive and apply focus
|
144
|
-
this.
|
145
|
-
await this.updateComplete;
|
146
|
-
this.shadowRoot.querySelector('.interactive-toggle').focus();
|
156
|
+
await this._handleInteractiveExit();
|
147
157
|
}
|
148
158
|
}
|
149
159
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.13.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",
|