@brightspace-ui/core 3.313.0 → 3.314.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,6 +6,7 @@ import { css, html, LitElement, nothing } 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
11
  import { ifDefined } from 'lit/directives/if-defined.js';
11
12
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
@@ -62,6 +63,11 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
62
63
  padding-bottom: 15px;
63
64
  }
64
65
 
66
+ .d2l-dialog-header > div {
67
+ display: flex;
68
+ flex-direction: row-reverse;
69
+ }
70
+
65
71
  .d2l-dialog-header > div > d2l-button-icon {
66
72
  flex: none;
67
73
  margin-block: -4px 0;
@@ -99,7 +105,7 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
99
105
  this.critical = false;
100
106
  this.describeContent = false;
101
107
  this.fullHeight = false;
102
- this.preferNative = false;
108
+ this.preferNative = getFlag('GAUD-10409-prefer-native-general-dialogs', true);
103
109
  this.width = 600;
104
110
  this._criticalLabelId = getUniqueId();
105
111
  this._titleId = getUniqueId();
@@ -162,18 +168,17 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
162
168
  <div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot @slotchange="${this._handleSlotChange}"></slot></div>
163
169
  `;
164
170
 
165
- const contentTabIndex = !this.focusableContentElemPresent ? '0' : undefined;
166
171
  const labelId = this.critical ? `${this._criticalLabelId} ${this._titleId}` : this._titleId;
167
172
  const inner = html`
168
173
  ${this.critical ? html`<div id="${this._criticalLabelId}" hidden>${this.localize('components.dialog.critical')}</div>` : nothing}
169
174
  <div class="d2l-dialog-inner" style=${styleMap(heightOverride)}>
170
175
  <div class="d2l-dialog-header">
171
176
  <div>
172
- <h2 id="${this._titleId}" class="d2l-heading-3">${this.titleText}</h2>
173
177
  <d2l-button-icon icon="tier1:close-small" text="${this.localize('components.dialog.close')}" @click="${this._abort}"></d2l-button-icon>
178
+ ${this._renderHeading(this.titleText, { id: this._titleId, class: 'd2l-heading-3' })}
174
179
  </div>
175
180
  </div>
176
- <div class="d2l-dialog-content" @pending-state="${this._handleAsyncItemState}" tabindex="${ifDefined(contentTabIndex)}">${content}</div>
181
+ ${this._renderContent(content, { handleAsyncItemState: this._handleAsyncItemState, hasTitleText: !!this.titleText })}
177
182
  <div class="${classMap(footerClasses)}">
178
183
  <slot name="footer" @slotchange="${this._handleFooterSlotChange}"></slot>
179
184
  </div>
@@ -210,6 +215,11 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
210
215
  this._close('abort');
211
216
  }
212
217
 
218
+ _focusInitial() {
219
+ if (!this.shadowRoot || this._useNative) return;
220
+ else super._focusInitial();
221
+ }
222
+
213
223
  _handleFooterSlotChange(e) {
214
224
  const footerContent = e.target.assignedNodes({ flatten: true });
215
225
  this._hasFooterContent = (footerContent && footerContent.length > 0);
@@ -3134,7 +3134,6 @@
3134
3134
  },
3135
3135
  {
3136
3136
  "name": "preferNative",
3137
- "type": "boolean",
3138
3137
  "default": "false"
3139
3138
  }
3140
3139
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.313.0",
3
+ "version": "3.314.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",