@brightspace-ui/core 2.31.2 → 2.32.1
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.
- package/components/dropdown/dropdown-opener-mixin.js +15 -11
- package/components/filter/README.md +43 -36
- package/components/filter/demo/filter-tags.html +9 -4
- package/components/filter/filter-tags.js +0 -1
- package/components/tag-list/tag-list.js +3 -1
- package/components/tooltip/tooltip-help.js +1 -1
- package/custom-elements.json +30 -0
- package/package.json +1 -1
|
@@ -14,6 +14,11 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
14
14
|
reflect: true
|
|
15
15
|
},
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
dropdownOpened: { state: true },
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* @ignore
|
|
19
24
|
*/
|
|
@@ -40,7 +45,6 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
40
45
|
attribute: 'open-on-hover'
|
|
41
46
|
},
|
|
42
47
|
_isHovering: { type: Boolean },
|
|
43
|
-
_isOpen: { type: Boolean },
|
|
44
48
|
_isOpenedViaClick: { type: Boolean },
|
|
45
49
|
_isFading: { type: Boolean }
|
|
46
50
|
};
|
|
@@ -55,7 +59,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
55
59
|
|
|
56
60
|
// hover option
|
|
57
61
|
this._dismissTimerId = getUniqueId();
|
|
58
|
-
this.
|
|
62
|
+
this.dropdownOpened = false;
|
|
59
63
|
this._isOpenedViaClick = false;
|
|
60
64
|
this._isHovering = false;
|
|
61
65
|
this._isFading = false;
|
|
@@ -121,7 +125,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
121
125
|
|
|
122
126
|
/* used by open-on-hover option */
|
|
123
127
|
async closeDropdown(fadeOut) {
|
|
124
|
-
this.
|
|
128
|
+
this.dropdownOpened = false;
|
|
125
129
|
this._isHovering = false;
|
|
126
130
|
this._isOpenedViaClick = false;
|
|
127
131
|
if (fadeOut) {
|
|
@@ -150,7 +154,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
150
154
|
|
|
151
155
|
/* used by open-on-hover option */
|
|
152
156
|
async openDropdown(applyFocus) {
|
|
153
|
-
this.
|
|
157
|
+
this.dropdownOpened = true;
|
|
154
158
|
const dropdownContent = this.__getContentElement();
|
|
155
159
|
if (!dropdownContent) return;
|
|
156
160
|
await dropdownContent.open(applyFocus);
|
|
@@ -167,7 +171,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
167
171
|
return;
|
|
168
172
|
}
|
|
169
173
|
content.toggleOpen(applyFocus);
|
|
170
|
-
this.
|
|
174
|
+
this.dropdownOpened = !this.dropdownOpened;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
__getContentElement() {
|
|
@@ -183,12 +187,12 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
183
187
|
}
|
|
184
188
|
opener.setAttribute('aria-expanded', 'false');
|
|
185
189
|
opener.removeAttribute('active');
|
|
186
|
-
this.
|
|
190
|
+
this.dropdownOpened = false;
|
|
187
191
|
this._isOpenedViaClick = false;
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
__onDropdownMouseUp() {
|
|
191
|
-
this.
|
|
195
|
+
this.dropdownOpened = true;
|
|
192
196
|
this._isFading = false;
|
|
193
197
|
this._isHovering = false;
|
|
194
198
|
this._isOpenedViaClick = true;
|
|
@@ -216,7 +220,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
216
220
|
const dropdownContent = this.__getContentElement();
|
|
217
221
|
if (dropdownContent._useMobileStyling) return;
|
|
218
222
|
clearTimeout(this._dismissTimerId);
|
|
219
|
-
if (!this.
|
|
223
|
+
if (!this.dropdownOpened) await this.openDropdown(false);
|
|
220
224
|
this._closeTimerStop();
|
|
221
225
|
if (!this._isOpenedViaClick) this._isHovering = true;
|
|
222
226
|
}
|
|
@@ -259,7 +263,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
259
263
|
e.stopPropagation();
|
|
260
264
|
}
|
|
261
265
|
this._closeTimerStop();
|
|
262
|
-
if (this.
|
|
266
|
+
if (this.dropdownOpened && !this._isHovering) {
|
|
263
267
|
this.closeDropdown();
|
|
264
268
|
} else {
|
|
265
269
|
this._isOpenedViaClick = true;
|
|
@@ -271,7 +275,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
271
275
|
|
|
272
276
|
/* used by open-on-hover option */
|
|
273
277
|
_closeTimerStart() {
|
|
274
|
-
if (this.
|
|
278
|
+
if (this.dropdownOpened) return;
|
|
275
279
|
clearTimeout(this._setTimeoutId);
|
|
276
280
|
this._isFading = true;
|
|
277
281
|
this._setTimeoutId = setTimeout(() => {
|
|
@@ -289,7 +293,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
289
293
|
|
|
290
294
|
/* used by open-on-hover option */
|
|
291
295
|
_onOutsideClick(e) {
|
|
292
|
-
if (!this.
|
|
296
|
+
if (!this.dropdownOpened) return;
|
|
293
297
|
const isWithinDropdown = isComposedAncestor(this.__getContentElement(), e.composedPath()[0]);
|
|
294
298
|
const isWithinOpener = isComposedAncestor(this.getOpenerElement(), e.composedPath()[0]);
|
|
295
299
|
const isBackdropClick = isWithinDropdown
|
|
@@ -239,47 +239,54 @@ A tag-list allowing the user to see (and remove) the currently applied filters.
|
|
|
239
239
|
import '@brightspace-ui/core/components/filter/filter-tags.js';
|
|
240
240
|
</script>
|
|
241
241
|
<style>
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
.filter-wrapper {
|
|
243
|
+
display: flex;
|
|
244
|
+
justify-content: space-between;
|
|
245
|
+
}
|
|
246
|
+
d2l-filter-tags {
|
|
247
|
+
align-self: center;
|
|
248
|
+
position: relative;
|
|
249
|
+
width: 100%;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
@media(max-width: 600px) {
|
|
253
|
+
.filter-wrapper {
|
|
248
254
|
display: block;
|
|
249
255
|
max-width: 100%;
|
|
250
256
|
}
|
|
251
257
|
}
|
|
252
258
|
</style>
|
|
253
|
-
|
|
254
|
-
<d2l-filter-tags filter-ids="core-filter core-filter-2"></d2l-filter-tags>
|
|
255
|
-
|
|
256
|
-
<d2l-filter id="core-filter">
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
</d2l-filter>
|
|
269
|
-
|
|
270
|
-
<d2l-filter id="core-filter-2">
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
</d2l-filter>
|
|
259
|
+
<div class="filter-wrapper">
|
|
260
|
+
<d2l-filter-tags filter-ids="core-filter core-filter-2"></d2l-filter-tags>
|
|
261
|
+
|
|
262
|
+
<d2l-filter id="core-filter">
|
|
263
|
+
<d2l-filter-dimension-set key="1" text="Dim 1">
|
|
264
|
+
<d2l-filter-dimension-set-value selected text="Option 1 - 1" key="1" ></d2l-filter-dimension-set-value>
|
|
265
|
+
<d2l-filter-dimension-set-value text="Option 1 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
266
|
+
<d2l-filter-dimension-set-value text="Option 1 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
267
|
+
<d2l-filter-dimension-set-value text="Option 1 - 4" key="4"></d2l-filter-dimension-set-value>
|
|
268
|
+
</d2l-filter-dimension-set>
|
|
269
|
+
<d2l-filter-dimension-set key="2" text="Dim 2">
|
|
270
|
+
<d2l-filter-dimension-set-value selected text="Option 2 - 1" key="1"></d2l-filter-dimension-set-value>
|
|
271
|
+
<d2l-filter-dimension-set-value text="Option 2 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
272
|
+
<d2l-filter-dimension-set-value text="Option 2 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
273
|
+
</d2l-filter-dimension-set>
|
|
274
|
+
</d2l-filter>
|
|
275
|
+
|
|
276
|
+
<d2l-filter id="core-filter-2">
|
|
277
|
+
<d2l-filter-dimension-set key="1" text="Dim 1" value-only-active-filter-text>
|
|
278
|
+
<d2l-filter-dimension-set-value selected text="Option 1 - 1" key="1" ></d2l-filter-dimension-set-value>
|
|
279
|
+
<d2l-filter-dimension-set-value text="Option 1 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
280
|
+
<d2l-filter-dimension-set-value text="Option 1 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
281
|
+
<d2l-filter-dimension-set-value text="Option 1 - 4" key="4"></d2l-filter-dimension-set-value>
|
|
282
|
+
</d2l-filter-dimension-set>
|
|
283
|
+
<d2l-filter-dimension-set key="2" text="Dim 2" value-only-active-filter-text>
|
|
284
|
+
<d2l-filter-dimension-set-value selected text="Option 2 - 1" key="1"></d2l-filter-dimension-set-value>
|
|
285
|
+
<d2l-filter-dimension-set-value text="Option 2 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
286
|
+
<d2l-filter-dimension-set-value text="Option 2 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
287
|
+
</d2l-filter-dimension-set>
|
|
288
|
+
</d2l-filter>
|
|
289
|
+
</div>
|
|
283
290
|
```
|
|
284
291
|
|
|
285
292
|
<!-- docs: start hidden content -->
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
import '../filter-dimension-set-value.js';
|
|
12
12
|
import '../filter-tags.js';
|
|
13
13
|
</script>
|
|
14
|
+
<style>
|
|
15
|
+
d2l-demo-snippet {
|
|
16
|
+
max-width: 1400px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
14
19
|
</head>
|
|
15
20
|
<body unresolved class="d2l-typography">
|
|
16
21
|
|
|
@@ -23,14 +28,14 @@
|
|
|
23
28
|
<d2l-filter id="core-filter">
|
|
24
29
|
<d2l-filter-dimension-set key="1" text="Dim 1">
|
|
25
30
|
<d2l-filter-dimension-set-value selected text="Option 1 - 1" key="1" ></d2l-filter-dimension-set-value>
|
|
26
|
-
<d2l-filter-dimension-set-value text="Option 1 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
31
|
+
<d2l-filter-dimension-set-value selected text="Option 1 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
27
32
|
<d2l-filter-dimension-set-value text="Option 1 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
28
33
|
<d2l-filter-dimension-set-value text="Option 1 - 4" key="4"></d2l-filter-dimension-set-value>
|
|
29
34
|
</d2l-filter-dimension-set>
|
|
30
35
|
<d2l-filter-dimension-set key="2" text="Dim 2">
|
|
31
|
-
<d2l-filter-dimension-set-value
|
|
32
|
-
<d2l-filter-dimension-set-value text="Option 2 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
33
|
-
<d2l-filter-dimension-set-value text="Option 2 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
36
|
+
<d2l-filter-dimension-set-value text="Option 2 - 1" key="1"></d2l-filter-dimension-set-value>
|
|
37
|
+
<d2l-filter-dimension-set-value selected text="Option 2 - 2" key="2"></d2l-filter-dimension-set-value>
|
|
38
|
+
<d2l-filter-dimension-set-value selected text="Option 2 - 3" key="3"></d2l-filter-dimension-set-value>
|
|
34
39
|
</d2l-filter-dimension-set>
|
|
35
40
|
</d2l-filter>
|
|
36
41
|
|
|
@@ -3,6 +3,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
3
3
|
import { announce } from '../../helpers/announce.js';
|
|
4
4
|
import { ArrowKeysMixin } from '../../mixins/arrow-keys-mixin.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
+
import { getOffsetParent } from '../../helpers/dom.js';
|
|
6
7
|
import { InteractiveMixin } from '../../mixins/interactive-mixin.js';
|
|
7
8
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
8
9
|
import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
|
|
@@ -133,7 +134,8 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
133
134
|
});
|
|
134
135
|
this._clearButtonResizeObserver.observe(clearButton);
|
|
135
136
|
|
|
136
|
-
|
|
137
|
+
let container = getOffsetParent(this);
|
|
138
|
+
if (!container || container.tagName === 'BODY') container = this.shadowRoot.querySelector('.tag-list-outer-container');
|
|
137
139
|
this._resizeObserver = new ResizeObserver((e) => requestAnimationFrame(() => this._handleResize(e)));
|
|
138
140
|
this._resizeObserver.observe(container);
|
|
139
141
|
|
|
@@ -102,7 +102,7 @@ class TooltipHelp extends FocusMixin(FocusVisiblePolyfillMixin(LitElement)) {
|
|
|
102
102
|
'd2l-body-small': !this.inheritFontStyle
|
|
103
103
|
};
|
|
104
104
|
return html`
|
|
105
|
-
<button id="d2l-tooltip-help-text" class="${classMap(classes)}">
|
|
105
|
+
<button id="d2l-tooltip-help-text" class="${classMap(classes)}" type="button">
|
|
106
106
|
${this.text}
|
|
107
107
|
</button>
|
|
108
108
|
<d2l-tooltip for="d2l-tooltip-help-text" delay="0" offset="13" position="${ifDefined(this.position)}" ?showing="${this.showing}">
|
package/custom-elements.json
CHANGED
|
@@ -1808,6 +1808,11 @@
|
|
|
1808
1808
|
"description": "Disables the dropdown opener",
|
|
1809
1809
|
"type": "boolean",
|
|
1810
1810
|
"default": "false"
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
"name": "dropdownOpened",
|
|
1814
|
+
"type": "boolean",
|
|
1815
|
+
"default": "false"
|
|
1811
1816
|
}
|
|
1812
1817
|
],
|
|
1813
1818
|
"slots": [
|
|
@@ -1891,6 +1896,11 @@
|
|
|
1891
1896
|
"description": "Disables the dropdown opener",
|
|
1892
1897
|
"type": "boolean",
|
|
1893
1898
|
"default": "false"
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
"name": "dropdownOpened",
|
|
1902
|
+
"type": "boolean",
|
|
1903
|
+
"default": "false"
|
|
1894
1904
|
}
|
|
1895
1905
|
],
|
|
1896
1906
|
"slots": [
|
|
@@ -2245,6 +2255,11 @@
|
|
|
2245
2255
|
"type": "boolean",
|
|
2246
2256
|
"default": "false"
|
|
2247
2257
|
},
|
|
2258
|
+
{
|
|
2259
|
+
"name": "dropdownOpened",
|
|
2260
|
+
"type": "boolean",
|
|
2261
|
+
"default": "false"
|
|
2262
|
+
},
|
|
2248
2263
|
{
|
|
2249
2264
|
"name": "visibleOnAncestor",
|
|
2250
2265
|
"type": "boolean",
|
|
@@ -2603,6 +2618,11 @@
|
|
|
2603
2618
|
"type": "boolean",
|
|
2604
2619
|
"default": "false"
|
|
2605
2620
|
},
|
|
2621
|
+
{
|
|
2622
|
+
"name": "dropdownOpened",
|
|
2623
|
+
"type": "boolean",
|
|
2624
|
+
"default": "false"
|
|
2625
|
+
},
|
|
2606
2626
|
{
|
|
2607
2627
|
"name": "visibleOnAncestor",
|
|
2608
2628
|
"type": "boolean",
|
|
@@ -2936,6 +2956,11 @@
|
|
|
2936
2956
|
"description": "Disables the dropdown opener",
|
|
2937
2957
|
"type": "boolean",
|
|
2938
2958
|
"default": "false"
|
|
2959
|
+
},
|
|
2960
|
+
{
|
|
2961
|
+
"name": "dropdownOpened",
|
|
2962
|
+
"type": "boolean",
|
|
2963
|
+
"default": "false"
|
|
2939
2964
|
}
|
|
2940
2965
|
],
|
|
2941
2966
|
"slots": [
|
|
@@ -8804,6 +8829,11 @@
|
|
|
8804
8829
|
"description": "Disables the dropdown opener",
|
|
8805
8830
|
"type": "boolean",
|
|
8806
8831
|
"default": "false"
|
|
8832
|
+
},
|
|
8833
|
+
{
|
|
8834
|
+
"name": "dropdownOpened",
|
|
8835
|
+
"type": "boolean",
|
|
8836
|
+
"default": "false"
|
|
8807
8837
|
}
|
|
8808
8838
|
],
|
|
8809
8839
|
"events": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.1",
|
|
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",
|