@brightspace-ui/core 3.240.4 → 3.240.5

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.
@@ -56,7 +56,7 @@ class BackdropDirtyOverlay extends LitElement {
56
56
 
57
57
  render() {
58
58
  return html`
59
- <p class="d2l-body-compact d2l-backdrop-dirty-overlay" tabindex="-1">${this.description}</p>
59
+ <p class="d2l-body-compact d2l-backdrop-dirty-overlay">${this.description}</p>
60
60
  <d2l-button-subtle
61
61
  class="d2l-backdrop-dirty-overlay-action"
62
62
  @click=${this.#handleActionClick}
@@ -1,11 +1,13 @@
1
1
  import '../colors/colors.js';
2
2
  import '../loading-spinner/loading-spinner.js';
3
3
  import './backdrop-dirty-overlay.js';
4
- import '../offscreen/offscreen.js';
5
4
  import { css, html, LitElement, nothing } from 'lit';
6
5
  import { getComposedChildren, getComposedParent } from '../../helpers/dom.js';
6
+ import { classMap } from 'lit/directives/class-map.js';
7
7
  import { getFlag } from '../../helpers/flags.js';
8
8
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
9
+ import { offscreenStyles } from '../offscreen/offscreen.js';
10
+
9
11
  import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
10
12
  import { styleMap } from 'lit/directives/style-map.js';
11
13
 
@@ -15,7 +17,6 @@ const BACKDROP_DELAY_MS = 800;
15
17
  const FADE_DURATION_MS = 500;
16
18
  const SPINNER_DELAY_MS = FADE_DURATION_MS;
17
19
  const LOADING_ANNOUNCEMENT_DELAY = 1000;
18
- const DIRTY_ANNOUNCEMENT_DELAY = 1000;
19
20
 
20
21
  const LOADING_SPINNER_SIZE = 50;
21
22
 
@@ -66,9 +67,18 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
66
67
  }
67
68
 
68
69
  static get styles() {
69
- return css`
70
+ return [css`
70
71
  #visible {
71
72
  display: none;
73
+ }
74
+
75
+ :host([_state="showing"]),
76
+ :host([_state="shown"]),
77
+ :host([_state="hiding"]),
78
+ :host([_state="showing"]) #visible,
79
+ :host([_state="shown"]) #visible,
80
+ :host([_state="hiding"]) #visible {
81
+ display: flex;
72
82
  height: 100%;
73
83
  justify-content: center;
74
84
  position: absolute;
@@ -76,11 +86,6 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
76
86
  width: 100%;
77
87
  z-index: 999;
78
88
  }
79
- :host([_state="showing"]) #visible,
80
- :host([_state="shown"]) #visible,
81
- :host([_state="hiding"]) #visible {
82
- display: flex;
83
- }
84
89
 
85
90
  .backdrop {
86
91
  background-color: var(--d2l-theme-backdrop-background-color);
@@ -134,7 +139,7 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
134
139
  @media (prefers-reduced-motion: reduce) {
135
140
  * { transition: none; }
136
141
  }
137
- `;
142
+ `, offscreenStyles];
138
143
  }
139
144
 
140
145
  constructor() {
@@ -148,16 +153,18 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
148
153
 
149
154
  render() {
150
155
  const forcedOffscreenSizelessStyles = OffSCREEN_SIZELESS ? {} : { height: '0px', width: '0px' };
156
+ const dirtyStateVisible = this._state !== 'hidden' && this.dataState === 'dirty';
151
157
 
152
158
  return html`
153
159
  ${this._state === 'hidden' ? nothing :
154
160
  html`<div id="visible">
155
161
  <div class="backdrop" @transitionend="${this.#handleTransitionEnd}" @transitioncancel="${this.#handleTransitionEnd}"></div>
156
162
  <d2l-loading-spinner style=${styleMap({ top: `${this._spinnerTop}px` })} size="${LOADING_SPINNER_SIZE}"></d2l-loading-spinner>
157
- ${this.#renderDirtyOverlay()}
158
163
  </div>`
159
164
  }
160
- <d2l-offscreen style=${styleMap(forcedOffscreenSizelessStyles)} aria-live="polite">${this._ariaContent}</d2l-offscreen>
165
+ <div aria-live="polite" class="${classMap({ 'd2l-offscreen': !dirtyStateVisible })}" style="${styleMap(dirtyStateVisible ? {} : forcedOffscreenSizelessStyles)}">
166
+ ${this.dataState === 'dirty' ? this.#renderDirtyOverlay() : this._ariaContent}
167
+ </div>
161
168
  `;
162
169
  }
163
170
  updated(changedProperties) {
@@ -190,8 +197,6 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
190
197
  this.#setLiveArea(this.localize('components.backdrop-loading.loadingAnnouncement'), { delay: LOADING_ANNOUNCEMENT_DELAY });
191
198
  } else if (oldState === 'loading' && newState === 'clean') {
192
199
  this.#setLiveArea(this.localize('components.backdrop-loading.loadingCompleteAnnouncement'));
193
- } else if (newState === 'dirty') {
194
- this.#setLiveArea(this.#renderDirtyOverlay(), { delay: DIRTY_ANNOUNCEMENT_DELAY });
195
200
  }
196
201
 
197
202
  // Update backdrop
@@ -227,13 +232,16 @@ class LoadingBackdrop extends PropertyRequiredMixin(LocalizeCoreElement(LitEleme
227
232
  // Adjust for the size of the spinner
228
233
  const spinnerSizeOffset = LOADING_SPINNER_SIZE / 2;
229
234
 
235
+ this._spinnerTop = centeringOffset + topOffset - spinnerSizeOffset;
236
+
230
237
  // Adjust for the size of the dirty dialog
231
- await this.shadowRoot.querySelector('d2l-backdrop-dirty-overlay').getUpdateComplete();
232
- await this.shadowRoot.querySelector('d2l-empty-state-action-button')?.getUpdateComplete();
233
- const dirtyDialogSizeOffset = this.shadowRoot.querySelector('d2l-backdrop-dirty-overlay').getBoundingClientRect().height / 2;
238
+ const dirtyOverlay = this.shadowRoot.querySelector('d2l-backdrop-dirty-overlay');
239
+ if (dirtyOverlay) {
240
+ await this.shadowRoot.querySelector('d2l-empty-state-action-button')?.getUpdateComplete();
241
+ const dirtyDialogSizeOffset = dirtyOverlay.getBoundingClientRect().height / 2;
234
242
 
235
- this._spinnerTop = centeringOffset + topOffset - spinnerSizeOffset;
236
- this._dirtyDialogTop = centeringOffset + topOffset - dirtyDialogSizeOffset;
243
+ this._dirtyDialogTop = centeringOffset + topOffset - dirtyDialogSizeOffset;
244
+ }
237
245
  }
238
246
 
239
247
  #clearLiveArea() {
@@ -23,7 +23,7 @@ class DropdownTabs extends DropdownPopoverMixin(LitElement) {
23
23
 
24
24
  this.addEventListener('d2l-dropdown-open', this.#handleOpen);
25
25
  this.addEventListener('d2l-menu-resize', this.#handleMenuResize);
26
- this.addEventListener('d2l-tab-panel-selected', this.#handleTabSelected);
26
+ this.addEventListener('d2l-tab-selected', this.#handleTabSelected);
27
27
  }
28
28
 
29
29
  #initializingHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.240.4",
3
+ "version": "3.240.5",
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",