@brightspace-ui/core 3.269.4 → 3.270.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.
- package/components/alert/alert-toast.js +46 -50
- package/components/card/card.js +12 -14
- package/components/dialog/dialog-mixin.js +55 -58
- package/components/dialog/dialog.js +8 -9
- package/components/dropdown/dropdown-opener-mixin.js +18 -19
- package/components/focus-trap/focus-trap.js +25 -28
- package/components/form/form-element-mixin.js +8 -10
- package/components/form/form.js +9 -20
- package/components/inputs/input-text.js +22 -24
- package/components/overflow-group/overflow-group-mixin.js +42 -44
- package/components/page/page.js +39 -19
- package/components/scroll-wrapper/scroll-wrapper.js +21 -23
- package/custom-elements.json +1 -1
- package/lang/ar.js +1 -0
- package/lang/ca.js +1 -0
- package/lang/cy.js +1 -0
- package/lang/da.js +1 -0
- package/lang/de.js +1 -0
- package/lang/en-gb.js +1 -0
- package/lang/en.js +1 -0
- package/lang/es-es.js +1 -0
- package/lang/es.js +1 -0
- package/lang/fr-fr.js +1 -0
- package/lang/fr.js +1 -0
- package/lang/haw.js +1 -0
- package/lang/hi.js +1 -0
- package/lang/ja.js +1 -0
- package/lang/ko.js +1 -0
- package/lang/mi.js +1 -0
- package/lang/nl.js +1 -0
- package/lang/pt.js +1 -0
- package/lang/sv.js +1 -0
- package/lang/th.js +1 -0
- package/lang/tr.js +1 -0
- package/lang/vi.js +1 -0
- package/lang/zh-cn.js +1 -0
- package/lang/zh-tw.js +1 -0
- package/mixins/rtl/rtl-mixin.js +5 -6
- package/package.json +1 -1
package/components/form/form.js
CHANGED
|
@@ -4,7 +4,6 @@ import '../link/link.js';
|
|
|
4
4
|
import { css, html, LitElement } from 'lit';
|
|
5
5
|
import { findFormElements, flattenMap, getFormElementData, isCustomFormElement, isNativeFormElement } from './form-helper.js';
|
|
6
6
|
import { findComposedAncestor } from '../../helpers/dom.js';
|
|
7
|
-
import { getComposedActiveElement } from '../../helpers/focus.js';
|
|
8
7
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
9
8
|
import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
|
|
10
9
|
import { localizeFormElement } from './form-element-localize-helper.js';
|
|
@@ -66,9 +65,6 @@ class Form extends LocalizeCoreElement(LitElement) {
|
|
|
66
65
|
this._tooltips = new Map();
|
|
67
66
|
this._validationCustoms = new Set();
|
|
68
67
|
|
|
69
|
-
this._onUnload = this._onUnload.bind(this);
|
|
70
|
-
this._onNativeSubmit = this._onNativeSubmit.bind(this);
|
|
71
|
-
|
|
72
68
|
/** @ignore */
|
|
73
69
|
this.addEventListener('d2l-form-connect', this._onFormConnect);
|
|
74
70
|
this.addEventListener('d2l-form-errors-change', this._onErrorsChange);
|
|
@@ -84,14 +80,14 @@ class Form extends LocalizeCoreElement(LitElement) {
|
|
|
84
80
|
|
|
85
81
|
connectedCallback() {
|
|
86
82
|
super.connectedCallback();
|
|
87
|
-
window.addEventListener('beforeunload', this
|
|
83
|
+
window.addEventListener('beforeunload', this.#onUnload);
|
|
88
84
|
/** @ignore */
|
|
89
85
|
this._isSubForm = !this.dispatchEvent(new CustomEvent('d2l-form-connect', { bubbles: true, composed: true, cancelable: true }));
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
disconnectedCallback() {
|
|
93
89
|
super.disconnectedCallback();
|
|
94
|
-
window.removeEventListener('beforeunload', this
|
|
90
|
+
window.removeEventListener('beforeunload', this.#onUnload);
|
|
95
91
|
/** @ignore */
|
|
96
92
|
this.dispatchEvent(new CustomEvent('d2l-form-disconnect'));
|
|
97
93
|
this._isSubForm = false;
|
|
@@ -193,6 +189,13 @@ class Form extends LocalizeCoreElement(LitElement) {
|
|
|
193
189
|
return flattenedErrorMap;
|
|
194
190
|
}
|
|
195
191
|
|
|
192
|
+
#onUnload = (e) => {
|
|
193
|
+
if (this.trackChanges && this._dirty) {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
e.returnValue = false;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
196
199
|
_displayInvalid(ele, message) {
|
|
197
200
|
let tooltip = this._tooltips.get(ele);
|
|
198
201
|
if (!tooltip) {
|
|
@@ -296,20 +299,6 @@ class Form extends LocalizeCoreElement(LitElement) {
|
|
|
296
299
|
this._updateErrors(ele, errors);
|
|
297
300
|
}
|
|
298
301
|
|
|
299
|
-
_onNativeSubmit(e) {
|
|
300
|
-
e.preventDefault();
|
|
301
|
-
e.stopPropagation();
|
|
302
|
-
const submitter = e.submitter || getComposedActiveElement();
|
|
303
|
-
this.requestSubmit(submitter);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
_onUnload(e) {
|
|
307
|
-
if (this.trackChanges && this._dirty) {
|
|
308
|
-
e.preventDefault();
|
|
309
|
-
e.returnValue = false;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
302
|
_setupDialogValidationReset() {
|
|
314
303
|
const dialogAncestor = findComposedAncestor(
|
|
315
304
|
this,
|
|
@@ -302,8 +302,6 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
302
302
|
this._lastSlotWidth = 0;
|
|
303
303
|
this._prevValue = '';
|
|
304
304
|
|
|
305
|
-
this._handleBlur = this._handleBlur.bind(this);
|
|
306
|
-
this._handleFocus = this._handleFocus.bind(this);
|
|
307
305
|
this._perfMonitor = new PerfMonitor(this);
|
|
308
306
|
}
|
|
309
307
|
|
|
@@ -369,8 +367,8 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
369
367
|
if (this._intersectionObserver) this._intersectionObserver.disconnect();
|
|
370
368
|
const container = this.shadowRoot && this.shadowRoot.querySelector('.d2l-input-text-container');
|
|
371
369
|
if (!container) return;
|
|
372
|
-
container.removeEventListener('blur', this
|
|
373
|
-
container.removeEventListener('focus', this
|
|
370
|
+
container.removeEventListener('blur', this.#handleBlur, true);
|
|
371
|
+
container.removeEventListener('focus', this.#handleFocus, true);
|
|
374
372
|
}
|
|
375
373
|
|
|
376
374
|
firstUpdated(changedProperties) {
|
|
@@ -380,8 +378,8 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
380
378
|
|
|
381
379
|
const container = this.shadowRoot && this.shadowRoot.querySelector('.d2l-input-text-container');
|
|
382
380
|
if (!container) return;
|
|
383
|
-
container.addEventListener('blur', this
|
|
384
|
-
container.addEventListener('focus', this
|
|
381
|
+
container.addEventListener('blur', this.#handleBlur, true);
|
|
382
|
+
container.addEventListener('focus', this.#handleFocus, true);
|
|
385
383
|
|
|
386
384
|
// if initially hidden then update layout when it becomes visible
|
|
387
385
|
if (typeof(IntersectionObserver) === 'function') {
|
|
@@ -534,6 +532,24 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
534
532
|
});
|
|
535
533
|
}
|
|
536
534
|
|
|
535
|
+
#handleBlur = async(e) => {
|
|
536
|
+
this._focused = false;
|
|
537
|
+
this.requestValidate(true);
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* This is needed only for Legacy-Edge
|
|
541
|
+
* the _handleChange function is NOT triggered, therefore we have to detect the blur and handle it ourselves.
|
|
542
|
+
*/
|
|
543
|
+
const browserType = window.navigator.userAgent;
|
|
544
|
+
if (this._prevValue !== e.target.value && (browserType.indexOf('Edge') > -1)) {
|
|
545
|
+
this._handleChange();
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
#handleFocus = () => {
|
|
550
|
+
this._focused = true;
|
|
551
|
+
};
|
|
552
|
+
|
|
537
553
|
_getAriaLabel() {
|
|
538
554
|
let label;
|
|
539
555
|
if (this.label && (this.labelHidden || this.labelledBy)) {
|
|
@@ -565,20 +581,6 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
565
581
|
this._hasAfterContent = (afterContent && afterContent.length > 0);
|
|
566
582
|
}
|
|
567
583
|
|
|
568
|
-
async _handleBlur(e) {
|
|
569
|
-
this._focused = false;
|
|
570
|
-
this.requestValidate(true);
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* This is needed only for Legacy-Edge
|
|
574
|
-
* the _handleChange function is NOT triggered, therefore we have to detect the blur and handle it ourselves.
|
|
575
|
-
*/
|
|
576
|
-
const browserType = window.navigator.userAgent;
|
|
577
|
-
if (this._prevValue !== e.target.value && (browserType.indexOf('Edge') > -1)) {
|
|
578
|
-
this._handleChange();
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
584
|
_handleChange() {
|
|
583
585
|
// Change events aren't composed, so we need to re-dispatch
|
|
584
586
|
this.dispatchEvent(new CustomEvent(
|
|
@@ -587,10 +589,6 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
|
587
589
|
));
|
|
588
590
|
}
|
|
589
591
|
|
|
590
|
-
_handleFocus() {
|
|
591
|
-
this._focused = true;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
592
|
_handleInput(e) {
|
|
595
593
|
this._setValue(e.target.value, false);
|
|
596
594
|
return true;
|
|
@@ -83,10 +83,8 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
|
|
|
83
83
|
constructor() {
|
|
84
84
|
super();
|
|
85
85
|
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this._itemObserver = new MutationObserver(this._handleItemMutation);
|
|
89
|
-
this._resizeObserver = new ResizeObserver((entries) => requestAnimationFrame(() => this._handleResize(entries)));
|
|
86
|
+
this._itemObserver = new MutationObserver(this.#handleItemMutation);
|
|
87
|
+
this._resizeObserver = new ResizeObserver((entries) => requestAnimationFrame(() => this.#handleResize(entries)));
|
|
90
88
|
|
|
91
89
|
this._hasResized = false;
|
|
92
90
|
this._isObservingResize = false;
|
|
@@ -183,6 +181,46 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
|
|
|
183
181
|
throw new Error('OverflowGroupMixin.getOverflowContainer must be overridden');
|
|
184
182
|
}
|
|
185
183
|
|
|
184
|
+
#handleItemMutation = (mutations) => {
|
|
185
|
+
if (!mutations || mutations.length === 0) return;
|
|
186
|
+
if (this._updateOverflowItemsRequested) return;
|
|
187
|
+
|
|
188
|
+
let isWidthModifyingMutation = false;
|
|
189
|
+
for (const mutation of mutations) {
|
|
190
|
+
if (mutation.attributeName
|
|
191
|
+
&& (mutation.attributeName === 'selected' || mutation.attributeName === 'text')
|
|
192
|
+
) {
|
|
193
|
+
isWidthModifyingMutation = true;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
this._updateOverflowItemsRequested = true;
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
this._overflowItems = this._slotItems.map((node) => this.convertToOverflowItem(node));
|
|
201
|
+
|
|
202
|
+
// when certain attributes change the corresponding item width can also change and so we need to re-get the layouts and chomp
|
|
203
|
+
if (isWidthModifyingMutation) {
|
|
204
|
+
this._itemLayouts = this._getItemLayouts(this._slotItems);
|
|
205
|
+
this._chomp();
|
|
206
|
+
}
|
|
207
|
+
this._updateOverflowItemsRequested = false;
|
|
208
|
+
this.requestUpdate();
|
|
209
|
+
}, 0);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
#handleResize = async(entries) => {
|
|
213
|
+
await (document.fonts ? document.fonts.ready : Promise.resolve()); // computed widths can be incorrect if we don't wait for fonts to load
|
|
214
|
+
this._availableWidth = Math.ceil(entries[0].contentRect.width);
|
|
215
|
+
|
|
216
|
+
if (!this._hasResized) {
|
|
217
|
+
this._hasResized = true;
|
|
218
|
+
this._handleSlotChange();
|
|
219
|
+
} else {
|
|
220
|
+
this._chomp();
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
186
224
|
_autoDetectBoundaries(items) {
|
|
187
225
|
if (!items) return;
|
|
188
226
|
|
|
@@ -335,46 +373,6 @@ export const OverflowGroupMixin = superclass => class extends LocalizeCoreElemen
|
|
|
335
373
|
return filteredNodes;
|
|
336
374
|
}
|
|
337
375
|
|
|
338
|
-
_handleItemMutation(mutations) {
|
|
339
|
-
if (!mutations || mutations.length === 0) return;
|
|
340
|
-
if (this._updateOverflowItemsRequested) return;
|
|
341
|
-
|
|
342
|
-
let isWidthModifyingMutation = false;
|
|
343
|
-
for (const mutation of mutations) {
|
|
344
|
-
if (mutation.attributeName
|
|
345
|
-
&& (mutation.attributeName === 'selected' || mutation.attributeName === 'text')
|
|
346
|
-
) {
|
|
347
|
-
isWidthModifyingMutation = true;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
this._updateOverflowItemsRequested = true;
|
|
353
|
-
setTimeout(() => {
|
|
354
|
-
this._overflowItems = this._slotItems.map((node) => this.convertToOverflowItem(node));
|
|
355
|
-
|
|
356
|
-
// when certain attributes change the corresponding item width can also change and so we need to re-get the layouts and chomp
|
|
357
|
-
if (isWidthModifyingMutation) {
|
|
358
|
-
this._itemLayouts = this._getItemLayouts(this._slotItems);
|
|
359
|
-
this._chomp();
|
|
360
|
-
}
|
|
361
|
-
this._updateOverflowItemsRequested = false;
|
|
362
|
-
this.requestUpdate();
|
|
363
|
-
}, 0);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
async _handleResize(entries) {
|
|
367
|
-
await (document.fonts ? document.fonts.ready : Promise.resolve()); // computed widths can be incorrect if we don't wait for fonts to load
|
|
368
|
-
this._availableWidth = Math.ceil(entries[0].contentRect.width);
|
|
369
|
-
|
|
370
|
-
if (!this._hasResized) {
|
|
371
|
-
this._hasResized = true;
|
|
372
|
-
this._handleSlotChange();
|
|
373
|
-
} else {
|
|
374
|
-
this._chomp();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
376
|
_handleSlotChange() {
|
|
379
377
|
if (!this._hasResized) return;
|
|
380
378
|
requestAnimationFrame(async() => {
|
package/components/page/page.js
CHANGED
|
@@ -111,20 +111,29 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
.content {
|
|
114
|
+
box-sizing: border-box;
|
|
114
115
|
display: flex;
|
|
115
116
|
margin-inline: var(--d2l-page-margin-inline, 0);
|
|
116
117
|
max-width: var(--d2l-page-content-max-width, 100%);
|
|
117
118
|
padding-bottom: var(--d2l-page-footer-height, 0); /* Reserve space for fixed footer */
|
|
118
119
|
}
|
|
120
|
+
.content.has-panels {
|
|
121
|
+
min-height: calc(100vh - var(--d2l-page-header-height-measured, 0px));
|
|
122
|
+
}
|
|
119
123
|
|
|
120
124
|
main {
|
|
121
125
|
flex: 1;
|
|
122
126
|
min-width: min(${MAIN_MIN_WIDTH}px, 100%);
|
|
123
127
|
}
|
|
124
128
|
|
|
129
|
+
.side-nav,
|
|
130
|
+
.supporting {
|
|
131
|
+
display: contents;
|
|
132
|
+
}
|
|
133
|
+
|
|
125
134
|
.side-nav-panel,
|
|
126
135
|
.supporting-panel {
|
|
127
|
-
height: calc(100vh - var(--d2l-page-header-height, 0) - var(--d2l-page-footer-height, 0));
|
|
136
|
+
max-height: calc(100vh - var(--d2l-page-header-height, 0) - var(--d2l-page-footer-height, 0));
|
|
128
137
|
overflow: clip auto;
|
|
129
138
|
position: sticky;
|
|
130
139
|
top: var(--d2l-page-header-height, 0);
|
|
@@ -166,6 +175,7 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
166
175
|
for (const entry of entries) {
|
|
167
176
|
if (entry.target.classList.contains('header')) {
|
|
168
177
|
this._headerHeight = entry.target.offsetHeight;
|
|
178
|
+
this.style.setProperty('--d2l-page-header-height-measured', `${this._headerHeight}px`);
|
|
169
179
|
|
|
170
180
|
const height = this._headerIsSticky ? this._headerHeight : 0;
|
|
171
181
|
this.style.setProperty('--d2l-page-header-height', `${height}px`);
|
|
@@ -216,11 +226,15 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
216
226
|
'page': true,
|
|
217
227
|
'header-sticky': this._headerIsSticky
|
|
218
228
|
};
|
|
229
|
+
const contentClasses = {
|
|
230
|
+
'content': true,
|
|
231
|
+
'has-panels': this._slotVisibility['side-nav'] || this._slotVisibility['supporting']
|
|
232
|
+
};
|
|
219
233
|
|
|
220
234
|
return html`
|
|
221
235
|
<div class="${classMap(pageClasses)}">
|
|
222
236
|
${this.#renderHeader()}
|
|
223
|
-
<div class="
|
|
237
|
+
<div class="${classMap(contentClasses)}">
|
|
224
238
|
${this.#renderSideNavPanel()}
|
|
225
239
|
<main><slot></slot></main>
|
|
226
240
|
${this.#renderSupportingPanel()}
|
|
@@ -308,7 +322,11 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
308
322
|
const footerContainerClasses = { 'footer': true, 'fixed-footer': fixedFooter };
|
|
309
323
|
const footerContents = html`<div class="footer-contents"><slot name="footer" @slotchange="${this.#handleSlotVisibilityChange}"></slot></div>`;
|
|
310
324
|
return html`
|
|
311
|
-
<div
|
|
325
|
+
<div
|
|
326
|
+
role="region"
|
|
327
|
+
aria-label="${this.localize('components.page.footer-region-label')}"
|
|
328
|
+
class="${classMap(footerContainerClasses)}"
|
|
329
|
+
?hidden="${!this._slotVisibility['footer']}">
|
|
312
330
|
${fixedFooter ? footerContents : this.#renderFloatingButtons(footerContents)}
|
|
313
331
|
</div>
|
|
314
332
|
`;
|
|
@@ -326,28 +344,30 @@ class Page extends ProviderMixin(LocalizeCoreElement(LitElement)) {
|
|
|
326
344
|
|
|
327
345
|
#renderSideNavPanel() {
|
|
328
346
|
return html`
|
|
329
|
-
<nav
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
347
|
+
<nav class="side-nav" aria-label="${this.localize('components.page.side-nav-label')}">
|
|
348
|
+
<div
|
|
349
|
+
class="side-nav-panel"
|
|
350
|
+
style=${styleMap({ width: `${this._panelState.getSize('side-nav')}px` })}
|
|
351
|
+
?hidden="${!this._slotVisibility['side-nav']}">
|
|
352
|
+
<slot name="side-nav" @slotchange="${this.#handleSlotVisibilityChange}"></slot>
|
|
353
|
+
</div>
|
|
354
|
+
${!this._slotVisibility['side-nav'] ? nothing :
|
|
355
|
+
this.#renderDivider('side-nav', this.localize('components.page.side-nav-divider-label'), 'start')}
|
|
335
356
|
</nav>
|
|
336
|
-
${!this._slotVisibility['side-nav'] ? nothing :
|
|
337
|
-
this.#renderDivider('side-nav', this.localize('components.page.side-nav-divider-label'), 'start')}
|
|
338
357
|
`;
|
|
339
358
|
}
|
|
340
359
|
|
|
341
360
|
#renderSupportingPanel() {
|
|
342
361
|
return html`
|
|
343
|
-
${
|
|
344
|
-
this
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
362
|
+
<aside class="supporting" aria-label="${this.localize('components.page.supporting-label')}">
|
|
363
|
+
${!this._slotVisibility['supporting'] ? nothing :
|
|
364
|
+
this.#renderDivider('supporting', this.localize('components.page.supporting-divider-label'), 'end')}
|
|
365
|
+
<div
|
|
366
|
+
class="supporting-panel"
|
|
367
|
+
style=${styleMap({ width: `${this._panelState.getSize('supporting')}px` })}
|
|
368
|
+
?hidden="${!this._slotVisibility['supporting']}">
|
|
369
|
+
<slot name="supporting" @slotchange="${this.#handleSlotVisibilityChange}"></slot>
|
|
370
|
+
</div>
|
|
351
371
|
</aside>
|
|
352
372
|
`;
|
|
353
373
|
}
|
|
@@ -168,9 +168,7 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
168
168
|
this._scrollbarRight = false;
|
|
169
169
|
this._syncDriver = null;
|
|
170
170
|
this._syncDriverTimeout = null;
|
|
171
|
-
this._checkScrollThresholds = this._checkScrollThresholds.bind(this);
|
|
172
171
|
|
|
173
|
-
this._synchronizeScroll = this._synchronizeScroll.bind(this);
|
|
174
172
|
}
|
|
175
173
|
|
|
176
174
|
disconnectedCallback() {
|
|
@@ -218,7 +216,7 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
218
216
|
checkScrollbar() {
|
|
219
217
|
if (!this._container) return;
|
|
220
218
|
this._hScrollbar = this._container.offsetWidth !== this._container.scrollWidth;
|
|
221
|
-
this
|
|
219
|
+
this.#checkScrollThresholds();
|
|
222
220
|
}
|
|
223
221
|
|
|
224
222
|
notifyResize() {
|
|
@@ -237,13 +235,24 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
237
235
|
}
|
|
238
236
|
}
|
|
239
237
|
|
|
240
|
-
|
|
238
|
+
#checkScrollThresholds = () => {
|
|
241
239
|
if (!this._container) return;
|
|
242
240
|
const lowerScrollValue = this._container.scrollWidth - this._baseContainer.offsetWidth - Math.abs(this._container.scrollLeft);
|
|
243
241
|
this._scrollbarLeft = (this._container.scrollLeft === 0);
|
|
244
242
|
this._scrollbarRight = (lowerScrollValue <= 0);
|
|
245
243
|
|
|
246
|
-
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
#synchronizeScroll = (e) => {
|
|
247
|
+
if (this._syncDriver && e.target !== this._syncDriver) return;
|
|
248
|
+
if (this._syncDriverTimeout) clearTimeout(this._syncDriverTimeout);
|
|
249
|
+
|
|
250
|
+
this._syncDriver = e.target;
|
|
251
|
+
this._allScrollers.forEach(element => {
|
|
252
|
+
if (element && element !== e.target) element.scrollLeft = e.target.scrollLeft;
|
|
253
|
+
});
|
|
254
|
+
this._syncDriverTimeout = setTimeout(() => this._syncDriver = null, 100);
|
|
255
|
+
};
|
|
247
256
|
|
|
248
257
|
_disconnectAll() {
|
|
249
258
|
this._resizeObserver?.disconnect();
|
|
@@ -252,11 +261,11 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
252
261
|
this._container.style.removeProperty('overflow-x');
|
|
253
262
|
this._container.classList.remove('d2l-scroll-wrapper-focus');
|
|
254
263
|
this._container.removeAttribute('tabindex');
|
|
255
|
-
this._container.removeEventListener('scroll', this
|
|
256
|
-
this._container.removeEventListener('scroll', this
|
|
264
|
+
this._container.removeEventListener('scroll', this.#synchronizeScroll);
|
|
265
|
+
this._container.removeEventListener('scroll', this.#checkScrollThresholds);
|
|
257
266
|
this._secondaryScrollers.forEach(element => {
|
|
258
267
|
element.style.removeProperty('overflow-x');
|
|
259
|
-
element.removeEventListener('scroll', this
|
|
268
|
+
element.removeEventListener('scroll', this.#synchronizeScroll);
|
|
260
269
|
});
|
|
261
270
|
}
|
|
262
271
|
}
|
|
@@ -276,17 +285,6 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
276
285
|
this.scrollDistance(scrollDistance, true);
|
|
277
286
|
}
|
|
278
287
|
|
|
279
|
-
_synchronizeScroll(e) {
|
|
280
|
-
if (this._syncDriver && e.target !== this._syncDriver) return;
|
|
281
|
-
if (this._syncDriverTimeout) clearTimeout(this._syncDriverTimeout);
|
|
282
|
-
|
|
283
|
-
this._syncDriver = e.target;
|
|
284
|
-
this._allScrollers.forEach(element => {
|
|
285
|
-
if (element && element !== e.target) element.scrollLeft = e.target.scrollLeft;
|
|
286
|
-
});
|
|
287
|
-
this._syncDriverTimeout = setTimeout(() => this._syncDriver = null, 100);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
288
|
_updateScrollTargets() {
|
|
291
289
|
this._disconnectAll();
|
|
292
290
|
|
|
@@ -307,17 +305,17 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
307
305
|
}
|
|
308
306
|
this._container.style.overflowX = 'auto';
|
|
309
307
|
this._resizeObserver.observe(this._container);
|
|
310
|
-
this._container.addEventListener('scroll', this
|
|
308
|
+
this._container.addEventListener('scroll', this.#checkScrollThresholds);
|
|
311
309
|
this._updateTabIndex();
|
|
312
310
|
}
|
|
313
311
|
|
|
314
312
|
if (this._secondaryScrollers.length) {
|
|
315
313
|
this._secondaryScrollers.forEach(element => {
|
|
316
314
|
element.style.overflowX = 'hidden';
|
|
317
|
-
element.addEventListener('scroll', this
|
|
315
|
+
element.addEventListener('scroll', this.#synchronizeScroll);
|
|
318
316
|
});
|
|
319
|
-
this._container.addEventListener('scroll', this
|
|
320
|
-
this
|
|
317
|
+
this._container.addEventListener('scroll', this.#synchronizeScroll);
|
|
318
|
+
this.#synchronizeScroll({ target: this._container });
|
|
321
319
|
}
|
|
322
320
|
}
|
|
323
321
|
|
package/custom-elements.json
CHANGED
|
@@ -6489,7 +6489,7 @@
|
|
|
6489
6489
|
{
|
|
6490
6490
|
"name": "styles",
|
|
6491
6491
|
"type": "CSSResult",
|
|
6492
|
-
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\t--d2l-page-header-max-width: 1230px;\\n\\t\\t\\t--d2l-page-content-max-width: 1230px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1230px;\\n\\t\\t\\t--d2l-page-margin-inline: auto;\\n\\t\\t\\t--d2l-page-padding: 30px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"wide\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 1440px;\\n\\t\\t\\t--d2l-page-content-max-width: 1440px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1440px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"fullscreen\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 100%;\\n\\t\\t\\t--d2l-page-content-max-width: 100%;\\n\\t\\t\\t--d2l-page-footer-max-width: 100%;\\n\\t\\t}\\n\\n\\t\\t@media (max-width: 929px) {\\n\\t\\t\\t:host {\\n\\t\\t\\t\\t--d2l-page-padding: 24px;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t@media (max-width: 767px) {\\n\\t\\t\\t:host {\\n\\t\\t\\t\\t--d2l-page-padding: 18px;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\t.header {\\n\\t\\t\\tposition: relative;\\n\\t\\t\\tz-index: 15; /* To be over sticky content of our core components */\\n\\t\\t}\\n\\n\\t\\t.page.header-sticky .header {\\n\\t\\t\\tposition: sticky;\\n\\t\\t\\ttop: 0;\\n\\t\\t}\\n\\n\\t\\t.content {\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\tmargin-inline: var(--d2l-page-margin-inline, 0);\\n\\t\\t\\tmax-width: var(--d2l-page-content-max-width, 100%);\\n\\t\\t\\tpadding-bottom: var(--d2l-page-footer-height, 0); /* Reserve space for fixed footer */\\n\\t\\t}\\n\\n\\t\\tmain {\\n\\t\\t\\tflex: 1;\\n\\t\\t\\tmin-width: min(${MAIN_MIN_WIDTH}px, 100%);\\n\\t\\t}\\n\\n\\t\\t.side-nav-panel,\\n\\t\\t.supporting-panel {\\n\\t\\t\\
|
|
6492
|
+
"default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\t--d2l-page-header-max-width: 1230px;\\n\\t\\t\\t--d2l-page-content-max-width: 1230px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1230px;\\n\\t\\t\\t--d2l-page-margin-inline: auto;\\n\\t\\t\\t--d2l-page-padding: 30px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"wide\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 1440px;\\n\\t\\t\\t--d2l-page-content-max-width: 1440px;\\n\\t\\t\\t--d2l-page-footer-max-width: 1440px;\\n\\t\\t}\\n\\n\\t\\t:host([width-type=\\\"fullscreen\\\"]) {\\n\\t\\t\\t--d2l-page-header-max-width: 100%;\\n\\t\\t\\t--d2l-page-content-max-width: 100%;\\n\\t\\t\\t--d2l-page-footer-max-width: 100%;\\n\\t\\t}\\n\\n\\t\\t@media (max-width: 929px) {\\n\\t\\t\\t:host {\\n\\t\\t\\t\\t--d2l-page-padding: 24px;\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\t@media (max-width: 767px) {\\n\\t\\t\\t:host {\\n\\t\\t\\t\\t--d2l-page-padding: 18px;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\t.header {\\n\\t\\t\\tposition: relative;\\n\\t\\t\\tz-index: 15; /* To be over sticky content of our core components */\\n\\t\\t}\\n\\n\\t\\t.page.header-sticky .header {\\n\\t\\t\\tposition: sticky;\\n\\t\\t\\ttop: 0;\\n\\t\\t}\\n\\n\\t\\t.content {\\n\\t\\t\\tbox-sizing: border-box;\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\tmargin-inline: var(--d2l-page-margin-inline, 0);\\n\\t\\t\\tmax-width: var(--d2l-page-content-max-width, 100%);\\n\\t\\t\\tpadding-bottom: var(--d2l-page-footer-height, 0); /* Reserve space for fixed footer */\\n\\t\\t}\\n\\t\\t.content.has-panels {\\n\\t\\t\\tmin-height: calc(100vh - var(--d2l-page-header-height-measured, 0px));\\n\\t\\t}\\n\\n\\t\\tmain {\\n\\t\\t\\tflex: 1;\\n\\t\\t\\tmin-width: min(${MAIN_MIN_WIDTH}px, 100%);\\n\\t\\t}\\n\\n\\t\\t.side-nav,\\n\\t\\t.supporting {\\n\\t\\t\\tdisplay: contents;\\n\\t\\t}\\n\\n\\t\\t.side-nav-panel,\\n\\t\\t.supporting-panel {\\n\\t\\t\\tmax-height: calc(100vh - var(--d2l-page-header-height, 0) - var(--d2l-page-footer-height, 0));\\n\\t\\t\\toverflow: clip auto;\\n\\t\\t\\tposition: sticky;\\n\\t\\t\\ttop: var(--d2l-page-header-height, 0);\\n\\t\\t}\\n\\n\\t\\t.footer:not([hidden]),\\n\\t\\t.floating-buttons-container {\\n\\t\\t\\tdisplay: inline;\\n\\t\\t}\\n\\t\\t.fixed-footer {\\n\\t\\t\\tbackground-color: white;\\n\\t\\t\\tbox-shadow: 0 -2px 4px rgba(32, 33, 34, 0.2); /* ferrite */\\n\\t\\t\\tinset: auto 0 0;\\n\\t\\t\\tpadding-block-start: 0.75rem;\\n\\t\\t\\tposition: fixed;\\n\\t\\t\\tz-index: 10; /* To be over sticky content of our core components */\\n\\t\\t}\\n\\t\\t.footer-contents {\\n\\t\\t\\tmargin-inline: var(--d2l-page-margin-inline, 0);\\n\\t\\t\\tmax-width: var(--d2l-page-footer-max-width, 100%);\\n\\t\\t}\\n\\t`\""
|
|
6493
6493
|
},
|
|
6494
6494
|
{
|
|
6495
6495
|
"name": "widthType",
|
package/lang/ar.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "المزيد",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "عنصر نائب",
|
|
157
157
|
"components.overflow-group.moreActions": "مزيد من الإجراءات",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "الرئيسية",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "جانبية",
|
package/lang/ca.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "més",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Element de marcador de posició",
|
|
157
157
|
"components.overflow-group.moreActions": "Més accions",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Principal",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Lateral",
|
package/lang/cy.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "mwy",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Eitem Dalfan",
|
|
157
157
|
"components.overflow-group.moreActions": "Rhagor o Gamau Gweithredu",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Prif",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Ochr",
|
package/lang/da.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "flere",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Pladsholder-element",
|
|
157
157
|
"components.overflow-group.moreActions": "Flere handlinger",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Hoved",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Side",
|
package/lang/de.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "mehr",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Platzhalterelement",
|
|
157
157
|
"components.overflow-group.moreActions": "Weitere Aktionen",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Haupt-",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Seiten-",
|
package/lang/en-gb.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "more",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Placeholder Item",
|
|
157
157
|
"components.overflow-group.moreActions": "More Actions",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Main",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Side",
|
package/lang/en.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "more",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Placeholder Item",
|
|
157
157
|
"components.overflow-group.moreActions": "More Actions",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Main",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Side",
|
package/lang/es-es.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "más",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Elemento de marcador de posición",
|
|
157
157
|
"components.overflow-group.moreActions": "Más acciones",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Principal",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Lateral",
|
package/lang/es.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "más",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Elemento de marcador de posición",
|
|
157
157
|
"components.overflow-group.moreActions": "Más acciones",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Principal",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Lateral",
|
package/lang/fr-fr.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "plus",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Élément d’espace réservé",
|
|
157
157
|
"components.overflow-group.moreActions": "Plus d’actions",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Principale",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Côté",
|
package/lang/fr.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "plus",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Élément de paramètre fictif",
|
|
157
157
|
"components.overflow-group.moreActions": "Plus d’actions",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Principal",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Côté",
|
package/lang/haw.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "hou aku",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Mea Paʻa Wahi",
|
|
157
157
|
"components.overflow-group.moreActions": "Nā Hana Hou",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Nui",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "ʻaoʻao",
|
package/lang/hi.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "अधिक",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "प्लेसहोल्डर आइटम",
|
|
157
157
|
"components.overflow-group.moreActions": "अधिक क्रियाएँ",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "मुख्य",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "साइड",
|
package/lang/ja.js
CHANGED
|
@@ -150,6 +150,7 @@ export default {
|
|
|
150
150
|
"components.more-less.more": "増やす",
|
|
151
151
|
"components.object-property-list.item-placeholder-text": "プレースホルダの項目",
|
|
152
152
|
"components.overflow-group.moreActions": "その他のアクション",
|
|
153
|
+
"components.page.footer-region-label": "Footer",
|
|
153
154
|
"components.page.header-nav-label": "メイン",
|
|
154
155
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
155
156
|
"components.page.side-nav-label": "サイド",
|
package/lang/ko.js
CHANGED
|
@@ -150,6 +150,7 @@ export default {
|
|
|
150
150
|
"components.more-less.more": "더 보기",
|
|
151
151
|
"components.object-property-list.item-placeholder-text": "자리표시자 항목",
|
|
152
152
|
"components.overflow-group.moreActions": "추가 작업",
|
|
153
|
+
"components.page.footer-region-label": "Footer",
|
|
153
154
|
"components.page.header-nav-label": "메인",
|
|
154
155
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
155
156
|
"components.page.side-nav-label": "사이드",
|
package/lang/mi.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "ētahi atu",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Tūemi Puriwāhi",
|
|
157
157
|
"components.overflow-group.moreActions": "Ētahi atu Hohenga",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Matua",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Taha",
|
package/lang/nl.js
CHANGED
|
@@ -155,6 +155,7 @@ export default {
|
|
|
155
155
|
"components.more-less.more": "meer",
|
|
156
156
|
"components.object-property-list.item-placeholder-text": "Item tijdelijke aanduiding",
|
|
157
157
|
"components.overflow-group.moreActions": "Meer acties",
|
|
158
|
+
"components.page.footer-region-label": "Footer",
|
|
158
159
|
"components.page.header-nav-label": "Hoofdgedeelte",
|
|
159
160
|
"components.page.side-nav-divider-label": "Side Navigation Divider",
|
|
160
161
|
"components.page.side-nav-label": "Zij",
|