@brightspace-ui/core 3.344.9 → 3.344.11
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './alert.js';
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
-
import { getFlag } from '../../helpers/flags.js';
|
|
5
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
5
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
7
6
|
|
|
@@ -12,10 +11,6 @@ function isPopoverSupported() {
|
|
|
12
11
|
return mockedPopoverSupported ?? ('popover' in HTMLElement.prototype);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
function usePopover() {
|
|
16
|
-
return getFlag('GAUD-10337-use-alert-toast-popover', true) && isPopoverSupported();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
14
|
const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
20
15
|
let activeReduceMotion = reduceMotion;
|
|
21
16
|
export function disableReducedMotionForTesting() {
|
|
@@ -236,7 +231,7 @@ class AlertToast extends LitElement {
|
|
|
236
231
|
insetBlockEnd: (this._totalSiblingHeightBelow || this._numAlertsBelow) ? `calc(${this._totalSiblingHeightBelow}px + ${spaceBetweenAlerts}rem)` : 0
|
|
237
232
|
};
|
|
238
233
|
const containerClasses = {
|
|
239
|
-
'd2l-alert-toast-container-not-popover': !
|
|
234
|
+
'd2l-alert-toast-container-not-popover': !isPopoverSupported(),
|
|
240
235
|
'd2l-alert-toast-container': true,
|
|
241
236
|
'd2l-alert-toast-container-close-clicked': this._closeClicked,
|
|
242
237
|
'd2l-alert-toast-container-lowest': !this._totalSiblingHeightBelow,
|
|
@@ -247,7 +242,7 @@ class AlertToast extends LitElement {
|
|
|
247
242
|
<div
|
|
248
243
|
class="${classMap(containerClasses)}"
|
|
249
244
|
data-state="${this._state}"
|
|
250
|
-
popover="${ifDefined(
|
|
245
|
+
popover="${ifDefined(isPopoverSupported() ? 'manual' : undefined)}"
|
|
251
246
|
style="${styleMap(containerStyles)}"
|
|
252
247
|
@transitionend="${this._onTransitionEnd}">
|
|
253
248
|
<d2l-alert
|
|
@@ -401,7 +396,7 @@ class AlertToast extends LitElement {
|
|
|
401
396
|
}
|
|
402
397
|
|
|
403
398
|
_onStateClosed() {
|
|
404
|
-
if (
|
|
399
|
+
if (isPopoverSupported()) {
|
|
405
400
|
this.shadowRoot.querySelector('[popover="manual"]')?.hidePopover();
|
|
406
401
|
}
|
|
407
402
|
this._state = states.CLOSED;
|
|
@@ -421,7 +416,7 @@ class AlertToast extends LitElement {
|
|
|
421
416
|
_openChanged(newOpen) {
|
|
422
417
|
if (newOpen) {
|
|
423
418
|
|
|
424
|
-
if (
|
|
419
|
+
if (isPopoverSupported()) {
|
|
425
420
|
// wait for popover attribute before managing top-layer (needed for case where toast is open immediately)
|
|
426
421
|
requestAnimationFrame(() => {
|
|
427
422
|
if (this.isConnected) this.shadowRoot.querySelector('[popover="manual"]')?.showPopover();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
|
-
import { getFlag } from '../../helpers/flags.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* A button container component for button toggles.
|
|
@@ -53,18 +52,6 @@ class ButtonToggle extends LitElement {
|
|
|
53
52
|
`;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
// remove with "button-toggle-no-change-event-on-prop-update" flag
|
|
57
|
-
updated(changedProperties) {
|
|
58
|
-
super.updated(changedProperties);
|
|
59
|
-
|
|
60
|
-
if (changedProperties.get('pressed') === undefined) return;
|
|
61
|
-
|
|
62
|
-
if (!getFlag('button-toggle-no-change-event-on-prop-update', true)) {
|
|
63
|
-
/** Dispatched when the pressed state changes */
|
|
64
|
-
this.dispatchEvent(new CustomEvent('d2l-button-toggle-change'));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
55
|
focus() {
|
|
69
56
|
if (!this.hasUpdated) {
|
|
70
57
|
this.#focusOnFirstRender = true;
|
|
@@ -106,10 +93,9 @@ class ButtonToggle extends LitElement {
|
|
|
106
93
|
this.pressed = newPressed;
|
|
107
94
|
await this.updateComplete;
|
|
108
95
|
this.focus();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
96
|
+
|
|
97
|
+
/** Dispatched when the pressed state changes */
|
|
98
|
+
this.dispatchEvent(new CustomEvent('d2l-button-toggle-change'));
|
|
113
99
|
}
|
|
114
100
|
|
|
115
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.344.
|
|
3
|
+
"version": "3.344.11",
|
|
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",
|