@brightspace-ui/core 3.221.2 → 3.222.1
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.
|
@@ -37,7 +37,7 @@ Alerts communicate critical information relating to the state of the system and
|
|
|
37
37
|
Inline Alerts can be placed anywhere in the page content
|
|
38
38
|
</d2l-alert>
|
|
39
39
|
<d2l-alert-toast id="alert-toast" type="success" open no-auto-close>
|
|
40
|
-
Toast Alerts appear at the
|
|
40
|
+
Toast Alerts appear at the bottom of the viewport
|
|
41
41
|
</d2l-alert-toast>
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -2,9 +2,12 @@ import '../colors/colors.js';
|
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { cssEscape, getComposedChildren, getComposedParent, isComposedAncestor, isVisible } from '../../helpers/dom.js';
|
|
4
4
|
import { getComposedActiveElement } from '../../helpers/focus.js';
|
|
5
|
+
import { getFlag } from '../../helpers/flags.js';
|
|
5
6
|
|
|
6
7
|
const BACKDROP_HIDDEN = 'data-d2l-backdrop-hidden';
|
|
7
8
|
const BACKDROP_ARIA_HIDDEN = 'data-d2l-backdrop-aria-hidden';
|
|
9
|
+
const BACKDROP_TABINDEX = 'data-d2l-backdrop-tabindex';
|
|
10
|
+
const BACKDROP_INERT = 'data-d2l-backdrop-inert';
|
|
8
11
|
const TRANSITION_DURATION = 200;
|
|
9
12
|
|
|
10
13
|
const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -174,6 +177,18 @@ function hideAccessible(target) {
|
|
|
174
177
|
}
|
|
175
178
|
child.setAttribute('aria-hidden', 'true');
|
|
176
179
|
|
|
180
|
+
if (child.hasAttribute('tabindex')) {
|
|
181
|
+
child.setAttribute(BACKDROP_TABINDEX, child.getAttribute('tabindex'));
|
|
182
|
+
}
|
|
183
|
+
child.setAttribute('tabindex', '-1');
|
|
184
|
+
|
|
185
|
+
if (getFlag('GAUD-9398-make-backdrop-inert', false)) {
|
|
186
|
+
if (child.hasAttribute('inert')) {
|
|
187
|
+
child.setAttribute(BACKDROP_INERT, '');
|
|
188
|
+
}
|
|
189
|
+
child.setAttribute('inert', '');
|
|
190
|
+
}
|
|
191
|
+
|
|
177
192
|
child.setAttribute(BACKDROP_HIDDEN, BACKDROP_HIDDEN);
|
|
178
193
|
hiddenElements.push(child);
|
|
179
194
|
}
|
|
@@ -201,6 +216,19 @@ function showAccessible(elems) {
|
|
|
201
216
|
} else {
|
|
202
217
|
elem.removeAttribute('aria-hidden');
|
|
203
218
|
}
|
|
219
|
+
if (elem.hasAttribute(BACKDROP_TABINDEX)) {
|
|
220
|
+
elem.setAttribute('tabindex', elem.getAttribute(BACKDROP_TABINDEX));
|
|
221
|
+
elem.removeAttribute(BACKDROP_TABINDEX);
|
|
222
|
+
} else {
|
|
223
|
+
elem.removeAttribute('tabindex');
|
|
224
|
+
}
|
|
225
|
+
if (getFlag('GAUD-9398-make-backdrop-inert', false)) {
|
|
226
|
+
if (elem.hasAttribute(BACKDROP_INERT)) {
|
|
227
|
+
elem.removeAttribute(BACKDROP_INERT);
|
|
228
|
+
} else {
|
|
229
|
+
elem.removeAttribute('inert');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
204
232
|
elem.removeAttribute(BACKDROP_HIDDEN);
|
|
205
233
|
}
|
|
206
234
|
}
|
|
@@ -57,6 +57,14 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
57
57
|
attribute: 'hide-actions',
|
|
58
58
|
type: Boolean
|
|
59
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* The area in pixels to offset scroll width calculations
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
scrollAreaOffset: {
|
|
65
|
+
attribute: 'scroll-area-offset',
|
|
66
|
+
type: Number
|
|
67
|
+
},
|
|
60
68
|
_hScrollbar: {
|
|
61
69
|
attribute: 'h-scrollbar',
|
|
62
70
|
reflect: true,
|
|
@@ -156,6 +164,7 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
156
164
|
super();
|
|
157
165
|
this.customScrollers = {};
|
|
158
166
|
this.hideActions = false;
|
|
167
|
+
this.scrollAreaOffset = 0;
|
|
159
168
|
this._allScrollers = [];
|
|
160
169
|
this._baseContainer = null;
|
|
161
170
|
this._container = null;
|
|
@@ -258,16 +267,19 @@ class ScrollWrapper extends LocalizeCoreElement(LitElement) {
|
|
|
258
267
|
});
|
|
259
268
|
}
|
|
260
269
|
}
|
|
270
|
+
_getScrollDistance() {
|
|
271
|
+
return Math.max((this._container.clientWidth - this.scrollAreaOffset) * SCROLL_AMOUNT, 1); // guard against offset being larger than content
|
|
272
|
+
}
|
|
261
273
|
|
|
262
274
|
_scrollLeft() {
|
|
263
275
|
if (!this._container) return;
|
|
264
|
-
const scrollDistance = this.
|
|
276
|
+
const scrollDistance = this._getScrollDistance() * -1;
|
|
265
277
|
this.scrollDistance(scrollDistance, true);
|
|
266
278
|
}
|
|
267
279
|
|
|
268
280
|
_scrollRight() {
|
|
269
281
|
if (!this._container) return;
|
|
270
|
-
const scrollDistance = this.
|
|
282
|
+
const scrollDistance = this._getScrollDistance();
|
|
271
283
|
this.scrollDistance(scrollDistance, true);
|
|
272
284
|
}
|
|
273
285
|
|
|
@@ -4,6 +4,8 @@ import '../backdrop/backdrop-loading.js';
|
|
|
4
4
|
import { css, html, LitElement, nothing } from 'lit';
|
|
5
5
|
import { cssSizes } from '../inputs/input-checkbox.js';
|
|
6
6
|
import { getComposedParent } from '../../helpers/dom.js';
|
|
7
|
+
import { getFlag } from '../../helpers/flags.js';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
9
|
import { isPopoverSupported } from '../popover/popover-mixin.js';
|
|
8
10
|
import { PageableMixin } from '../paging/pageable-mixin.js';
|
|
9
11
|
import { SelectionMixin } from '../selection/selection-mixin.js';
|
|
@@ -296,6 +298,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
296
298
|
reflect: true,
|
|
297
299
|
type: Boolean
|
|
298
300
|
},
|
|
301
|
+
_stickyWidth: { state: true },
|
|
299
302
|
/**
|
|
300
303
|
* Type of table style to apply. The "light" style has fewer borders and tighter padding.
|
|
301
304
|
* @type {'default'|'light'}
|
|
@@ -376,6 +379,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
376
379
|
this.noColumnBorder = false;
|
|
377
380
|
this.stickyHeaders = false;
|
|
378
381
|
this.stickyHeadersScrollWrapper = false;
|
|
382
|
+
this._stickyWidth = 0;
|
|
379
383
|
this.type = 'default';
|
|
380
384
|
|
|
381
385
|
this._controls = null;
|
|
@@ -388,6 +392,8 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
388
392
|
this._tableMutationObserver = null;
|
|
389
393
|
this._tableScrollers = {};
|
|
390
394
|
this.loading = false;
|
|
395
|
+
|
|
396
|
+
this._excludeStickyColumnsFromScrollCalculations = getFlag('GAUD-9530-exclude-sticky-columns-from-scroll-calculations', false);
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
connectedCallback() {
|
|
@@ -424,7 +430,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
424
430
|
return html`
|
|
425
431
|
<slot name="controls" @slotchange="${this._handleControlsSlotChange}"></slot>
|
|
426
432
|
${this.stickyHeaders && this._controlsScrolled ? html`<div class="d2l-sticky-headers-backdrop"></div>` : nothing}
|
|
427
|
-
${useScrollWrapper ? html`<d2l-scroll-wrapper .customScrollers="${this._tableScrollers}">${slot}</d2l-scroll-wrapper>` : slot}
|
|
433
|
+
${useScrollWrapper ? html`<d2l-scroll-wrapper scroll-area-offset=${ifDefined(this._excludeStickyColumnsFromScrollCalculations ? this._stickyWidth : undefined)} .customScrollers="${this._tableScrollers}">${slot}</d2l-scroll-wrapper>` : slot}
|
|
428
434
|
${this._renderPagerContainer()}
|
|
429
435
|
`;
|
|
430
436
|
}
|
|
@@ -722,21 +728,25 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
|
|
|
722
728
|
|
|
723
729
|
if (candidateRowHeadCells.length !== candidateRowBodyLength) return;
|
|
724
730
|
|
|
731
|
+
let stickyWidth = 0;
|
|
725
732
|
for (let i = 0; i < candidateRowHeadCells.length; i++) {
|
|
726
733
|
const headCell = candidateRowHeadCells[i];
|
|
727
734
|
const headStyle = getComputedStyle(headCell);
|
|
728
735
|
|
|
729
736
|
const bodyCell = candidateRowBody.cells[i];
|
|
730
737
|
const bodyStyle = getComputedStyle(bodyCell);
|
|
731
|
-
|
|
738
|
+
let cellWidth = headCell.clientWidth + parseFloat(headStyle.borderLeft) + parseFloat(headStyle.borderRight);
|
|
732
739
|
if (headCell.clientWidth > bodyCell.clientWidth) {
|
|
733
740
|
const headOverallWidth = parseFloat(headStyle.width) + parseFloat(headStyle.paddingLeft) + parseFloat(headStyle.paddingRight);
|
|
734
741
|
bodyCell.style.minWidth = `${headOverallWidth - parseFloat(bodyStyle.paddingLeft) - parseFloat(bodyStyle.paddingRight)}px`;
|
|
735
742
|
} else if (headCell.clientWidth < bodyCell.clientWidth) {
|
|
736
743
|
const bodyOverallWidth = parseFloat(bodyStyle.width) + parseFloat(bodyStyle.paddingLeft) + parseFloat(bodyStyle.paddingRight);
|
|
737
744
|
headCell.style.minWidth = `${bodyOverallWidth - parseFloat(headStyle.paddingLeft) - parseFloat(headStyle.paddingRight)}px`;
|
|
745
|
+
cellWidth = bodyCell.clientWidth + parseFloat(bodyStyle.borderLeft) + parseFloat(bodyStyle.borderRight);
|
|
738
746
|
}
|
|
747
|
+
if (headCell.hasAttribute('sticky')) stickyWidth += cellWidth;
|
|
739
748
|
}
|
|
749
|
+
if (this._excludeStickyColumnsFromScrollCalculations) this._stickyWidth = stickyWidth;
|
|
740
750
|
}
|
|
741
751
|
|
|
742
752
|
_updateStickyAncestor(node, popoverOpened) {
|
package/custom-elements.json
CHANGED
|
@@ -12523,6 +12523,12 @@
|
|
|
12523
12523
|
"description": "Whether to hide left/right scroll buttons",
|
|
12524
12524
|
"type": "boolean",
|
|
12525
12525
|
"default": "false"
|
|
12526
|
+
},
|
|
12527
|
+
{
|
|
12528
|
+
"name": "scroll-area-offset",
|
|
12529
|
+
"description": "The area in pixels to offset scroll width calculations",
|
|
12530
|
+
"type": "number",
|
|
12531
|
+
"default": "0"
|
|
12526
12532
|
}
|
|
12527
12533
|
],
|
|
12528
12534
|
"properties": [
|
|
@@ -12538,6 +12544,13 @@
|
|
|
12538
12544
|
"description": "Whether to hide left/right scroll buttons",
|
|
12539
12545
|
"type": "boolean",
|
|
12540
12546
|
"default": "false"
|
|
12547
|
+
},
|
|
12548
|
+
{
|
|
12549
|
+
"name": "scrollAreaOffset",
|
|
12550
|
+
"attribute": "scroll-area-offset",
|
|
12551
|
+
"description": "The area in pixels to offset scroll width calculations",
|
|
12552
|
+
"type": "number",
|
|
12553
|
+
"default": "0"
|
|
12541
12554
|
}
|
|
12542
12555
|
],
|
|
12543
12556
|
"slots": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.222.1",
|
|
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",
|