@brightspace-ui/core 3.309.1 → 3.311.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.
|
@@ -6,8 +6,8 @@ import { css, html, LitElement } from 'lit';
|
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js';
|
|
7
7
|
import { DialogMixin } from './dialog-mixin.js';
|
|
8
8
|
import { dialogStyles } from './dialog-styles.js';
|
|
9
|
+
import { getFlag } from '../../helpers/flags.js';
|
|
9
10
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
10
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
11
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
12
12
|
import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
|
|
13
13
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
@@ -49,6 +49,11 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
|
49
49
|
|
|
50
50
|
static styles = [_generateResetStyles(':host'), dialogStyles, heading2Styles, heading3Styles, css`
|
|
51
51
|
|
|
52
|
+
.d2l-dialog-header > div {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: row-reverse;
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
.d2l-dialog-footer.d2l-footer-no-content {
|
|
53
58
|
display: none;
|
|
54
59
|
}
|
|
@@ -189,7 +194,7 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
|
189
194
|
super();
|
|
190
195
|
this.async = false;
|
|
191
196
|
this.noPadding = false;
|
|
192
|
-
this.preferNative =
|
|
197
|
+
this.preferNative = getFlag('GAUD-10336-prefer-native-fullscreen-dialogs', true);
|
|
193
198
|
this._autoSize = false;
|
|
194
199
|
this._hasFooterContent = false;
|
|
195
200
|
this._icon = 'tier1:close-large-thick';
|
|
@@ -251,17 +256,15 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
|
251
256
|
<div style=${styleMap(slotStyles)}><slot @slotchange="${this._handleSlotChange}"></slot></div>
|
|
252
257
|
`;
|
|
253
258
|
|
|
254
|
-
const contentTabIndex = !this.focusableContentElemPresent ? '0' : undefined;
|
|
255
|
-
|
|
256
259
|
const inner = html`
|
|
257
260
|
<div class="d2l-dialog-inner" style=${styleMap(heightOverride)}>
|
|
258
261
|
<div class="d2l-dialog-header">
|
|
259
262
|
<div>
|
|
260
|
-
<h2 id="${this._titleId}" class="${this._headerStyle}">${this.titleText}</h2>
|
|
261
263
|
<d2l-button-icon icon="${this._icon}" text="${this.localize('components.dialog.close')}" @click="${this._abort}"></d2l-button-icon>
|
|
264
|
+
${this._renderHeading(this.titleText, { id: this._titleId, class: this._headerStyle })}
|
|
262
265
|
</div>
|
|
263
266
|
</div>
|
|
264
|
-
|
|
267
|
+
${this._renderContent(content, { handleAsyncItemState: this._handleAsyncItemState, hasTitleText: !!this.titleText })}
|
|
265
268
|
<div class="${classMap(footerClasses)}">
|
|
266
269
|
<slot name="footer" @slotchange="${this._handleFooterSlotChange}"></slot>
|
|
267
270
|
</div>
|
|
@@ -296,6 +299,11 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
|
296
299
|
this._close('abort');
|
|
297
300
|
}
|
|
298
301
|
|
|
302
|
+
_focusInitial() {
|
|
303
|
+
if (!this.shadowRoot || this._useNative) return;
|
|
304
|
+
else super._focusInitial();
|
|
305
|
+
}
|
|
306
|
+
|
|
299
307
|
_handleFooterSlotChange(e) {
|
|
300
308
|
const footerContent = e.target.assignedNodes({ flatten: true });
|
|
301
309
|
this._hasFooterContent = (footerContent && footerContent.length > 0);
|
|
@@ -582,6 +582,32 @@ export const DialogMixin = superclass => class extends superclass {
|
|
|
582
582
|
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
+
_renderContent(content, options) {
|
|
586
|
+
let tabIndex = undefined;
|
|
587
|
+
let autoFocus = false;
|
|
588
|
+
if (this._useNative) {
|
|
589
|
+
if (!options.hasTitleText) {
|
|
590
|
+
tabIndex = '-1';
|
|
591
|
+
autoFocus = true;
|
|
592
|
+
}
|
|
593
|
+
} else {
|
|
594
|
+
tabIndex = !this.focusableContentElemPresent ? '0' : undefined;
|
|
595
|
+
}
|
|
596
|
+
return html`<div ?autofocus="${autoFocus}" class="d2l-dialog-content" @pending-state="${ifDefined(options.handleAsyncItemState)}" tabindex="${ifDefined(tabIndex)}">${content}</div>`;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
_renderHeading(text, options) {
|
|
600
|
+
let tabIndex = undefined;
|
|
601
|
+
let autoFocus = false;
|
|
602
|
+
if (this._useNative) {
|
|
603
|
+
if (text) {
|
|
604
|
+
tabIndex = '-1';
|
|
605
|
+
autoFocus = true;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return html`<h2 ?autofocus="${autoFocus}" class="${ifDefined(options.class)}" id="${ifDefined(options.id)}" tabindex="${ifDefined(tabIndex)}">${text}</h2>`;
|
|
609
|
+
}
|
|
610
|
+
|
|
585
611
|
_tryApplyFocus(node) {
|
|
586
612
|
const focusable = getFirstFocusableRelative(node);
|
|
587
613
|
if (focusable) focusable.focus();
|
package/custom-elements.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.311.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",
|