@brightspace-ui/core 1.236.3 → 1.237.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.
@@ -84,6 +84,12 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
84
84
  width: auto;
85
85
  }
86
86
 
87
+ dialog.d2l-dialog-outer.d2l-dialog-fullscreen-within,
88
+ div.d2l-dialog-outer.d2l-dialog-fullscreen-within {
89
+ /* no margins when there is a fullscreen element within */
90
+ margin: 0;
91
+ }
92
+
87
93
  :host(:not([in-iframe])) dialog.d2l-dialog-outer,
88
94
  :host(:not([in-iframe])) div.d2l-dialog-outer {
89
95
  height: calc(100% - 3rem);
@@ -369,6 +369,12 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
369
369
  | `selected` | Boolean | Whether the item is selected |
370
370
  | `skeleton` | Boolean | Renders the input as a skeleton loader |
371
371
 
372
+ ### Methods
373
+
374
+ - `highlight()`: highlights the item
375
+ - `scrollToItem()`: scrolls to the item
376
+ - `scrollToAndHighlight()`: scrolls to the item and then highlights it
377
+
372
378
  ### Events
373
379
 
374
380
  - `d2l-list-item-link-click`: dispatched when the item's primary link action is clicked
@@ -77,6 +77,8 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
77
77
  _hoveringPrimaryAction: { type: Boolean },
78
78
  _focusing: { type: Boolean },
79
79
  _focusingPrimaryAction: { type: Boolean },
80
+ _highlight: { type: Boolean },
81
+ _highlighting: { type: Boolean },
80
82
  _tooltipShowing: { type: Boolean, attribute: '_tooltip-showing', reflect: true }
81
83
  };
82
84
  }
@@ -97,6 +99,7 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
97
99
  z-index: 10; /* must be greater than adjacent selected items */
98
100
  }
99
101
  :host([_fullscreen-within]) {
102
+ position: absolute; /* required for Safari */
100
103
  z-index: 1000; /* must be greater than floating workflow buttons */
101
104
  }
102
105
  :host(:first-child) d2l-list-item-generic-layout[data-separators="between"] {
@@ -282,14 +285,40 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
282
285
  border-color: #79b5df;
283
286
  }
284
287
  :host([selected]:not([disabled])) .d2l-list-item-active-border,
285
- :host([selected]:not([disabled])) d2l-list-item-generic-layout.d2l-focusing + .d2l-list-item-active-border {
286
- background: #79b5df;
288
+ :host([selected]:not([disabled])) d2l-list-item-generic-layout.d2l-focusing + .d2l-list-item-active-border,
289
+ :host(:not([disabled])) .d2l-list-item-highlight + .d2l-list-item-active-border {
290
+ background-color: #79b5df;
287
291
  bottom: 0;
288
292
  height: 1px;
289
293
  position: absolute;
290
294
  width: 100%;
291
295
  z-index: 5;
292
296
  }
297
+
298
+ .d2l-list-item-highlight {
299
+ transition: background-color 400ms linear, border-color 400ms linear;
300
+ }
301
+ .d2l-list-item-highlight + .d2l-list-item-active-border {
302
+ transition: background-color 400ms linear;
303
+ }
304
+ d2l-list-item-generic-layout.d2l-list-item-highlighting,
305
+ :host([selectable]:not([disabled]):not([skeleton])) d2l-list-item-generic-layout.d2l-list-item-highlighting.d2l-focusing,
306
+ :host([selectable]:not([disabled]):not([skeleton])) d2l-list-item-generic-layout.d2l-list-item-highlighting.d2l-hovering {
307
+ background-color: var(--d2l-color-celestine-plus-2);
308
+ border-color: var(--d2l-color-celestine);
309
+ }
310
+ :host(:not([disabled])) d2l-list-item-generic-layout.d2l-list-item-highlighting + .d2l-list-item-active-border {
311
+ background-color: var(--d2l-color-celestine);
312
+ }
313
+ :host([selected]:not([disabled])) d2l-list-item-generic-layout.d2l-list-item-highlighting {
314
+ background-color: var(--d2l-color-celestine-plus-2);
315
+ border-color: var(--d2l-color-celestine);
316
+ }
317
+ :host([selected]:not([disabled])) .d2l-list-item-highlighting + .d2l-list-item-active-border,
318
+ :host([selected]:not([disabled])) d2l-list-item-generic-layout.d2l-list-item-highlighting.d2l-focusing + .d2l-list-item-active-border {
319
+ background-color: var(--d2l-color-celestine);
320
+ }
321
+
293
322
  :host([_fullscreen-within]) .d2l-list-item-active-border,
294
323
  :host([_fullscreen-within]) d2l-list-item-generic-layout.d2l-focusing + .d2l-list-item-active-border {
295
324
  display: none;
@@ -365,6 +394,21 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
365
394
  if (node) node.focus();
366
395
  }
367
396
 
397
+ async highlight() {
398
+ if (this._highlight) return;
399
+ const elem = this.shadowRoot.querySelector('d2l-list-item-generic-layout');
400
+ this._highlight = true;
401
+ await this.updateComplete;
402
+ elem.addEventListener('transitionend', () => {
403
+ // more than one property is being animated so this rAF waits before wiring up the return phase listener
404
+ setTimeout(() => {
405
+ elem.addEventListener('transitionend', () => this._highlight = false, { once: true });
406
+ this._highlighting = false;
407
+ }, 1000);
408
+ }, { once: true });
409
+ this._highlighting = true;
410
+ }
411
+
368
412
  resizedCallback(width) {
369
413
  const lastBreakpointIndexToCheck = 3;
370
414
  this.breakpoints.some((breakpoint, index) => {
@@ -375,6 +419,19 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
375
419
  });
376
420
  }
377
421
 
422
+ scrollToAndHighlight() {
423
+ this.scrollToItem();
424
+ setTimeout(() => {
425
+ this.highlight();
426
+ }, 1000);
427
+ }
428
+
429
+ scrollToItem() {
430
+ const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
431
+ if (reduceMotion) this.scrollIntoView();
432
+ else this.scrollIntoView({ behavior: 'smooth' });
433
+ }
434
+
378
435
  _getNestedList() {
379
436
  if (!this.shadowRoot) return;
380
437
  const nestedSlot = this.shadowRoot.querySelector('slot[name="nested"]');
@@ -470,6 +527,8 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
470
527
  const classes = {
471
528
  'd2l-visible-on-ancestor-target': true,
472
529
  'd2l-list-item-content-extend-separators': this._extendSeparators,
530
+ 'd2l-list-item-highlight': this._highlight,
531
+ 'd2l-list-item-highlighting': this._highlighting,
473
532
  'd2l-focusing': this._focusing,
474
533
  'd2l-hovering': this._hovering,
475
534
  'd2l-dragging-over': this._draggingOver
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.236.3",
3
+ "version": "1.237.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",