@brightspace-ui/core 2.37.3 → 2.38.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.
- package/components/dropdown/dropdown-opener-mixin.js +9 -0
- package/components/empty-state/empty-state-action-button.js +1 -0
- package/components/empty-state/empty-state-styles.js +1 -1
- package/components/tag-list/tag-list.js +19 -9
- package/controllers/subscriber/subscriberControllers.js +1 -1
- package/custom-elements.json +36 -1
- package/package.json +1 -1
|
@@ -174,6 +174,13 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
174
174
|
this.dropdownOpened = !this.dropdownOpened;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
__dispatchOpenerClickEvent() {
|
|
178
|
+
/** Dispatched when the opener is clicked, useful for when no-auto-open is enabled */
|
|
179
|
+
this.dispatchEvent(new CustomEvent(
|
|
180
|
+
'd2l-dropdown-opener-click', { bubbles: false, composed: false }
|
|
181
|
+
));
|
|
182
|
+
}
|
|
183
|
+
|
|
177
184
|
__getContentElement() {
|
|
178
185
|
if (!this.shadowRoot) return undefined;
|
|
179
186
|
return this.shadowRoot.querySelector('slot:not([name])').assignedNodes()
|
|
@@ -202,6 +209,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
202
209
|
__onKeypress(e) {
|
|
203
210
|
if (e.srcElement === this || isComposedAncestor(this.getOpenerElement(), e.srcElement)) {
|
|
204
211
|
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
212
|
+
this.__dispatchOpenerClickEvent();
|
|
205
213
|
if (this.noAutoOpen) return;
|
|
206
214
|
if (!this.openOnHover) {
|
|
207
215
|
this.toggleOpen(true);
|
|
@@ -256,6 +264,7 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
|
|
|
256
264
|
}
|
|
257
265
|
|
|
258
266
|
__onOpenerMouseUp(e) {
|
|
267
|
+
this.__dispatchOpenerClickEvent();
|
|
259
268
|
if (this.noAutoOpen) return;
|
|
260
269
|
if (this.openOnHover) {
|
|
261
270
|
// prevent propogation to window and triggering _onOutsideClick
|
|
@@ -5,6 +5,7 @@ import { css, html, LitElement, nothing } from 'lit';
|
|
|
5
5
|
/**
|
|
6
6
|
* `d2l-empty-state-action-button` is an empty state action component that can be placed inside of the default slot of `empty-state-simple` or `empty-state-illustrated` to add a button action to the component.
|
|
7
7
|
* @fires d2l-empty-state-action - Dispatched when the action button is clicked
|
|
8
|
+
* @fires d2l-empty-state-illustrated-check - Internal event
|
|
8
9
|
*/
|
|
9
10
|
class EmptyStateActionButton extends LitElement {
|
|
10
11
|
|
|
@@ -130,19 +130,19 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
130
130
|
|
|
131
131
|
const clearButton = this.shadowRoot.querySelector('d2l-button-subtle.d2l-tag-list-clear-button');
|
|
132
132
|
this._clearButtonResizeObserver = new ResizeObserver(() => {
|
|
133
|
-
this._clearButtonWidth =
|
|
133
|
+
this._clearButtonWidth = parseFloat(getComputedStyle(clearButton).getPropertyValue('width'));
|
|
134
134
|
this._clearButtonHeight = Math.ceil(parseFloat(getComputedStyle(clearButton).getPropertyValue('height')));
|
|
135
135
|
});
|
|
136
136
|
this._clearButtonResizeObserver.observe(clearButton);
|
|
137
137
|
|
|
138
138
|
let container = getOffsetParent(this);
|
|
139
|
-
if (!container
|
|
139
|
+
if (!container) container = this.shadowRoot.querySelector('.tag-list-outer-container');
|
|
140
140
|
this._resizeObserver = new ResizeObserver((e) => requestAnimationFrame(() => this._handleResize(e)));
|
|
141
141
|
this._resizeObserver.observe(container);
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
this._listContainer = this.shadowRoot.querySelector('.tag-list-container');
|
|
144
144
|
this._listContainerObserver = new ResizeObserver(() => requestAnimationFrame(() => this._handleSlotChange()));
|
|
145
|
-
this._listContainerObserver.observe(
|
|
145
|
+
this._listContainerObserver.observe(this._listContainer);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
render() {
|
|
@@ -248,6 +248,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
248
248
|
*/
|
|
249
249
|
let isOverflowing = false;
|
|
250
250
|
let overflowingIndex = 0;
|
|
251
|
+
|
|
251
252
|
for (let k = 1; k <= this._lines; k++) {
|
|
252
253
|
showing.width = 0;
|
|
253
254
|
|
|
@@ -269,7 +270,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
if (!isOverflowing && !this.clearable) {
|
|
273
|
+
if (!isOverflowing && (!this.clearable || this._items.length < CLEAR_ALL_THRESHOLD)) {
|
|
273
274
|
this._chompIndex = showing.count;
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
@@ -297,7 +298,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
297
298
|
|
|
298
299
|
return {
|
|
299
300
|
isHidden: computedStyles.display === 'none',
|
|
300
|
-
width:
|
|
301
|
+
width: parseFloat(computedStyles.width) || 0
|
|
301
302
|
};
|
|
302
303
|
});
|
|
303
304
|
|
|
@@ -369,8 +370,12 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
369
370
|
this._hasShownKeyboardTooltip = true;
|
|
370
371
|
}
|
|
371
372
|
|
|
372
|
-
async _handleResize(
|
|
373
|
-
this.
|
|
373
|
+
async _handleResize() {
|
|
374
|
+
this._contentReady = false;
|
|
375
|
+
this._chompIndex = 10000;
|
|
376
|
+
await this.updateComplete;
|
|
377
|
+
|
|
378
|
+
this._availableWidth = Math.ceil(this._listContainer.getBoundingClientRect().width);
|
|
374
379
|
if (this._availableWidth >= PAGE_SIZE.large) this._lines = PAGE_SIZE_LINES.large;
|
|
375
380
|
else if (this._availableWidth < PAGE_SIZE.large && this._availableWidth >= PAGE_SIZE.medium) this._lines = PAGE_SIZE_LINES.medium;
|
|
376
381
|
else this._lines = PAGE_SIZE_LINES.small;
|
|
@@ -380,6 +385,7 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
380
385
|
} else {
|
|
381
386
|
this._chomp();
|
|
382
387
|
}
|
|
388
|
+
this._contentReady = true;
|
|
383
389
|
}
|
|
384
390
|
|
|
385
391
|
async _handleSlotChange() {
|
|
@@ -388,17 +394,21 @@ class TagList extends LocalizeCoreElement(InteractiveMixin(ArrowKeysMixin(LitEle
|
|
|
388
394
|
await this.updateComplete;
|
|
389
395
|
|
|
390
396
|
this._items = await this._getTagListItems();
|
|
397
|
+
this._chompIndex = 10000;
|
|
391
398
|
if (!this._items || this._items.length === 0) {
|
|
392
|
-
this._chompIndex = 10000;
|
|
393
399
|
return;
|
|
394
400
|
}
|
|
401
|
+
await this.updateComplete;
|
|
395
402
|
|
|
396
403
|
this._itemLayouts = this._getItemLayouts(this._items);
|
|
397
404
|
this._itemHeight = this._items[0].offsetHeight;
|
|
398
405
|
this._items.forEach((item, index) => {
|
|
399
406
|
item.setAttribute('tabIndex', index === 0 ? 0 : -1);
|
|
400
407
|
});
|
|
408
|
+
|
|
409
|
+
this._availableWidth = Math.ceil(this._listContainer.getBoundingClientRect().width);
|
|
401
410
|
this._chomp();
|
|
411
|
+
|
|
402
412
|
this._contentReady = true;
|
|
403
413
|
if (!this._hasShownKeyboardTooltip) this._items[0].setAttribute('keyboard-tooltip-item', 'keyboard-tooltip-item');
|
|
404
414
|
}
|
|
@@ -151,7 +151,7 @@ export class IdSubscriberController {
|
|
|
151
151
|
let registryIds = this._host[this._idPropertyName];
|
|
152
152
|
if (!registryIds) return;
|
|
153
153
|
|
|
154
|
-
registryIds = registryIds.split(' ');
|
|
154
|
+
registryIds = registryIds.trim().split(' ');
|
|
155
155
|
registryIds.forEach(registryId => {
|
|
156
156
|
this._updateRegistry(registryId, 0);
|
|
157
157
|
});
|
package/custom-elements.json
CHANGED
|
@@ -1815,6 +1815,12 @@
|
|
|
1815
1815
|
"default": "false"
|
|
1816
1816
|
}
|
|
1817
1817
|
],
|
|
1818
|
+
"events": [
|
|
1819
|
+
{
|
|
1820
|
+
"name": "d2l-dropdown-opener-click",
|
|
1821
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
1822
|
+
}
|
|
1823
|
+
],
|
|
1818
1824
|
"slots": [
|
|
1819
1825
|
{
|
|
1820
1826
|
"name": "",
|
|
@@ -1903,6 +1909,12 @@
|
|
|
1903
1909
|
"default": "false"
|
|
1904
1910
|
}
|
|
1905
1911
|
],
|
|
1912
|
+
"events": [
|
|
1913
|
+
{
|
|
1914
|
+
"name": "d2l-dropdown-opener-click",
|
|
1915
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
1916
|
+
}
|
|
1917
|
+
],
|
|
1906
1918
|
"slots": [
|
|
1907
1919
|
{
|
|
1908
1920
|
"name": "",
|
|
@@ -2266,6 +2278,12 @@
|
|
|
2266
2278
|
"default": "false"
|
|
2267
2279
|
}
|
|
2268
2280
|
],
|
|
2281
|
+
"events": [
|
|
2282
|
+
{
|
|
2283
|
+
"name": "d2l-dropdown-opener-click",
|
|
2284
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
2285
|
+
}
|
|
2286
|
+
],
|
|
2269
2287
|
"slots": [
|
|
2270
2288
|
{
|
|
2271
2289
|
"name": "",
|
|
@@ -2629,6 +2647,12 @@
|
|
|
2629
2647
|
"default": "false"
|
|
2630
2648
|
}
|
|
2631
2649
|
],
|
|
2650
|
+
"events": [
|
|
2651
|
+
{
|
|
2652
|
+
"name": "d2l-dropdown-opener-click",
|
|
2653
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
2654
|
+
}
|
|
2655
|
+
],
|
|
2632
2656
|
"slots": [
|
|
2633
2657
|
{
|
|
2634
2658
|
"name": "",
|
|
@@ -2963,6 +2987,12 @@
|
|
|
2963
2987
|
"default": "false"
|
|
2964
2988
|
}
|
|
2965
2989
|
],
|
|
2990
|
+
"events": [
|
|
2991
|
+
{
|
|
2992
|
+
"name": "d2l-dropdown-opener-click",
|
|
2993
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
2994
|
+
}
|
|
2995
|
+
],
|
|
2966
2996
|
"slots": [
|
|
2967
2997
|
{
|
|
2968
2998
|
"name": "",
|
|
@@ -3010,7 +3040,8 @@
|
|
|
3010
3040
|
"description": "Dispatched when the action button is clicked"
|
|
3011
3041
|
},
|
|
3012
3042
|
{
|
|
3013
|
-
"name": "d2l-empty-state-illustrated-check"
|
|
3043
|
+
"name": "d2l-empty-state-illustrated-check",
|
|
3044
|
+
"description": "Internal event"
|
|
3014
3045
|
}
|
|
3015
3046
|
]
|
|
3016
3047
|
},
|
|
@@ -9071,6 +9102,10 @@
|
|
|
9071
9102
|
{
|
|
9072
9103
|
"name": "d2l-selection-observer-subscribe",
|
|
9073
9104
|
"description": "Internal event"
|
|
9105
|
+
},
|
|
9106
|
+
{
|
|
9107
|
+
"name": "d2l-dropdown-opener-click",
|
|
9108
|
+
"description": "Dispatched when the opener is clicked, useful for when no-auto-open is enabled"
|
|
9074
9109
|
}
|
|
9075
9110
|
],
|
|
9076
9111
|
"slots": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.38.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",
|